Cześć, męczę go już którąś godzinę i nie mam bladego pojęcia, czemu nie działa.
To jest mój prosty xaml z RelativePanel i VisualStateManager:
<Page
x:Class="AnotherApp.Views.TestPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AnotherApp.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Name="page"
Background="Brown"
SizeChanged="Page_SizeChanged"
MinWidth="300"
>
<RelativePanel BorderBrush="Black" BorderThickness="10" Name="panel">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="Mobiles">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="header.MinHeight" Value="150"/>
<Setter Target="menu.MinHeight" Value="100"/>
<Setter Target="menu.MinWidth" Value="0"/>
<Setter Target="menu.RelativePanel.AlignRightWithPanel" Value="True"/>
<Setter Target="menu.RelativePanel.AlignBottomWithPanel" Value="False"/>
<Setter Target="content.RelativePanel.Below" Value="menu"/>
<Setter Target="content.RelativePanel.AlignLeftWithPanel" Value="True"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Desktops">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="800"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="header.MinHeight" Value="300"/>
<Setter Target="menu.MinWidth" Value="300"/>
<Setter Target="menu.RelativePanel.AlignBottomWithPanel" Value="True"/>
<Setter Target="menu.RelativePanel.AlignRightWithPanel" Value="False"/>
<Setter Target="content.RelativePanel.Below" Value="header"/>
<Setter Target="content.RelativePanel.RightOf" Value="menu"/>
<Setter Target="content.RelativePanel.AlignLeftWithPanel" Value="False"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle Fill="Red" MinHeight="300" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignLeftWithPanel="True" x:Name="header"/>
<Rectangle Fill="Green" MinWidth="300" RelativePanel.Below="header" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignBottomWithPanel="True" x:Name="menu"/>
<Rectangle Fill="Blue" RelativePanel.Below="header" RelativePanel.RightOf="menu" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignBottomWithPanel="True" x:Name="content"/>
<!--<Border Background="Red" Height="100" Name="header" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignTopWithPanel="True">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Window width: " Padding="10" />
<TextBlock Text="{Binding WindowWidth, Mode=OneWay}" Padding="0,10,0,10"/>
</StackPanel>
</Border>
<Rectangle Fill="Green" MinHeight="100" RelativePanel.Below="header" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Name="menu"/>
<Rectangle Fill="Blue" RelativePanel.Below="menu" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignBottomWithPanel="True" Name="content"/>-->
</RelativePanel>
</Page>
Przeglądam kody, dokumentacje, fora i nie mogę znaleźć powodu, dla którego nie działa.
Przy oknie >= 800 px, powinno się pokazać:
Na górze czerwony prostokat (header)
Pod nim po lewej zielony (menu)
Po prawej od zielonego - niebieski (content)
Przy szerokości < 800 wszystkie 3 prostokąty powinny być jedne pod drugim. Co tu jest nie tak?