Windows phone ScrollViewer doesn't work when projection is applied - windows-phone-8.1

I discovered this issue in real complex project, but it's reproducible with simple test project. So I have the test UWP page
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid
VerticalAlignment="Top"
HorizontalAlignment="Left"
Height="100">
<Grid.Projection>
<PlaneProjection GlobalOffsetY="100"/>
</Grid.Projection>
<ScrollViewer
VerticalScrollMode="Enabled"
VerticalScrollBarVisibility="Visible">
<StackPanel>
<Button Content="1"/>
<Button Content="2"/>
<Button Content="3"/>
<Button Content="4"/>
<Button Content="5"/>
<Button Content="6"/>
<Button Content="7"/>
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
it works as expected in PC version, but scroller doesn't work in mobile (windows phone) version. the same story with Windows Phone 8.1
If to comment projection on parent grid - everything is ok.
Any ideas of fix or at least workaround for that issue?

it works as expected in PC version, but scroller doesn't work in mobile (windows phone) version.
By design,if a global transform of scrollviewer(Projection Transform here) can't be represented as a Matrix Transform, the underlying layer that handles touch interaction can't be used.
So if you only need to apply GlobalOffsetY or GlobalOffsetX. I recommend you using TranslateTransform instead. It won't prevent ScrollViewer from scrolling:
<Grid
VerticalAlignment="Top"
HorizontalAlignment="Left"
Height="500" Width="200">
<Grid.RenderTransform>
<TranslateTransform Y="100"/>
</Grid.RenderTransform>
<ScrollViewer
VerticalScrollMode="Enabled"
VerticalScrollBarVisibility="Visible">
<StackPanel>
<Button Content="1"/>
<Button Content="2"/>
<Button Content="3"/>
<Button Content="4"/>
<Button Content="5"/>
<Button Content="6"/>
<Button Content="7"/>
</StackPanel>
</ScrollViewer>
</Grid>

Related

ListboxItem design for Multiresolution App windows phone

I want to develop app which is targeting to Multi resolution Device i Windows Phone(i.e. : 480*800 to 1080*1920)
this is my code for list box
<ListBox x:Name="LstContact">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="#cbc6c0"
BorderThickness="0,0,0,2"
Margin="10">
<Grid >
<TextBlock Text="{Binding FirstName}"
Foreground="Black"
FontSize="22"
Margin="10" />
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
And output should be like this
please help to that
It is Silverlight, so just put something like Width="480" to your Border and you are done.

Windows Phone 8.1 & MenuFlyout: How to disable zoom effect

I am trying to add context menu (through MenuFlyout) for button:
<StackPanel Orientation="Horizontal">
<Button Content="Item1" />
<Button Content="Item2" />
<Button Content="Item3" >
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="Item31" />
<MenuFlyoutItem Text="Item32" />
<MenuFlyoutItem Text="Item33" />
</MenuFlyout>
</Button.Flyout>
</Button>
</StackPanel>
But MenuFlyout zooms Button on which it opens. How to disable zoom effect?
You can't.
If you really need a simple overlay without animations, you need to create your own (an UserControl is an idea).

Hot to make content float over keyboard?

I have a page witch a fixed title followed by a content and a textbox that enables the user to post to my app. When the user press the textbox the keyboard shows up and all the control slide up making impossible for the user to scroll then back?
How can I make the controls float under the keyboard so the user can scroll it.
I have tried witch grids and scrollviewers without success :(
My layout:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto " />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle Width="Auto" Height="50" Fill="Red" />
<Grid Grid.Row="1">
<Rectangle Height="600" Fill="Green" VerticalAlignment="Top" />
</Grid>
<TextBox Grid.Row="1" Width="Auto" Background="Black" VerticalAlignment="Bottom" />
</Grid>
This is what is happening
This is what i expect to happen
The following article explains how to resolve the issue by manipulating the transformations done by the OS to the page.
http://klingdigital.net/2013/06/scrollviewer-and-multiline-textbox-windowsphone/

RelayCommand and popup in Windows Phone

I'm currently writing app for Windows Phone 8.0 and I have a problem with RelayCommand from MVVM Toolkit light and popup.
I have a LongListSelector on the popup:
<Popup x:Name="popUp" Grid.Row="0" Grid.RowSpan="3" Opened="PopupOpened">
<Grid>
<ScrollViewer Grid.Row="2" Margin="10">
<phone:LongListSelector ItemsSource="{Binding ItemsSelections}"
ItemTemplate="{StaticResource DetailsItemTemplate}" />
</ScrollViewer>
</Grid>
</Popup>
And item's template:
<DataTemplate x:Key="DetailsItemTemplate">
<Button VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Margin="5,5,5,5"
Command="{Binding ElementName=LayoutRoot,Path=DataContext.ItemExecutionCommand}"
CommandParameter="{Binding Type}">
</Button>
</DataTemplate>
When I open popup for the first time, everything works fine, CanExecute returns false, buttons are disabled and the disable style is applied (foreground is gray). But, when I close popup and open again, buttons are disabled, but have normal style (foreground is white). Executing RaiseCanExecuteChanged method after every popup opening does not help.
Anyone has this problem?

Windows Phone 8 Strikethrough

I'm developing a windows phone 8 application.
I've got a textblock with a price in it.
Only thing I want to do is a line through the textblock.
I've tried to use the Line function but that one doesn't work because the textblock has a variable length.
Does anyone know how I can make this happen?
This worked for me thanks to Chkon for giving me the answer in this thread:
<Grid HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Some text" VerticalAlignment="Top" Grid.RowSpan="2"/>
<Border BorderThickness="0,0,0,1" BorderBrush="#FF949494" >
</Border>
</Grid>