I'm amateur in Windows Phone, how can i auto change size for orientation in Landscape mode and Portrait mode?
in C# WinForms i can use Dock or Anchor and it totally works fine but in windows phone i can't.
here is my XAML code, is that possible help me?
<phone:PhoneApplicationPage
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:local="clr-namespace:testApp"
x:Class="testApp.DLPage"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
Background="#FF262626"
shell:SystemTray.IsVisible="False" >
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn" />
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn" />
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut" />
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut" />
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
<ScrollViewer HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid x:Name="gridOrg" HorizontalAlignment="Left" VerticalAlignment="Top" Width="480" Height="800" >
<Grid x:Name="gridPanel" HorizontalAlignment="Left" Height="780" Margin="10,10,0,0" VerticalAlignment="Top" Width="460" Background="#FF3E3E3E">
<Ellipse x:Name="elp" HorizontalAlignment="Left" Height="455" Margin="4,4,0,0" Stroke="Black" VerticalAlignment="Top" Width="453" Tap="elp_Tap"/>
<TextBlock x:Name="txtTitle" HorizontalAlignment="Left" Margin="6,478,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="162" Width="447"/>
<TextBlock x:Name="cntDL" HorizontalAlignment="Left" Margin="6,662,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="52" Width="447"/>
</Grid>
<local:LoadingControl x:Name="pb" HorizontalAlignment="Left" Margin="10,377,0,0" VerticalAlignment="Top" Width="460"/>
</Grid>
</ScrollViewer>
</phone:PhoneApplicationPage>
i try to set Width in auto for all controls but didn't work.
thanks
If I understand you correctly, you want your UI to look the same no matter what screen size or ratio it's launched on. You could use canvas controll and place the elements of your interface inside it, but the only answer you should go with is: don't use hard-coded values, use stars and Auto instead. Your UI is going to look great on every screen. Your columns/rows are going to stretch/shrink to fit the height and width of the user’s phone.
More info and examples: Multi-resolution apps for Windows Phone 8