in my uwp desktop application. I have crated one user control for header. for responsive UI i am using the VisualStateManager But its not working when i am resizing the page.i want to keep moving right hand side controls to left when i am resizing the page.this code working in some situation.
I want to reduce the middle blank space size when i am resize the window. thanks in advance :)
<UserControl
x:Class="UWPUIResponsive.UC_Header"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:forms="using:Xamarin.Forms"
mc:Ignorable="d"
d:DesignWidth="400" Height="50" BorderBrush="Silver" BorderThickness="0 0 1 1" >
<Grid >
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth = "720" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!--<Setter Target = "Parent.Orientation" Value = "Horizontal" />-->
<Setter Target = "CThree.Width" Value = "Auto" />
<Setter Target = "CFour.Width" Value = "Auto" />
<Setter Target = "CTen.Width" Value = "Auto" />
<Setter Target = "CThree.Width" Value = "Auto" />
<Setter Target = "CEight.Width" Value = "Auto" />
<Setter Target = "CSix.Width" Value = "Auto" />
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth = "1250" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!--<Setter Target = "Parent.Orientation" Value = "Horizontal" />-->
<Setter Target = "Cone.Width" Value = "10*" />
<Setter Target = "CTwo.Width" Value = "60*" />
<Setter Target = "CThree.Width" Value = "250*" />
<Setter Target = "CFour.Width" Value = "16*" />
<Setter Target = "CFive.Width" Value = "*" />
<Setter Target = "CSix.Width" Value = "23*" />
<Setter Target = "CSeven.Width" Value = "" />
<Setter Target = "CEight.Width" Value = "8*" />
<Setter Target = "CNine.Width" Value = "" />
<Setter Target = "CTen.Width" Value = "4*" />
<Setter Target = "CEleven.Width" Value = "25*" />
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<!--VisualState to be triggered when window
width is >=720 effective pixels.-->
<AdaptiveTrigger MinWindowWidth = "500" />
</VisualState.StateTriggers>
<VisualState.Setters>
<!--<Setter Target = "Parent.Orientation" Value = "Horizontal" />-->
<Setter Target = "Cone.Width" Value = "Auto" />
<Setter Target = "CTwo.Width" Value = "Auto" />
<Setter Target = "CThree.Width" Value = "Auto" />
<Setter Target = "CFour.Width" Value = "Auto" />
<Setter Target = "CFive.Width" Value = "Auto" />
<Setter Target = "CSix.Width" Value = "Auto" />
<Setter Target = "CSeven.Width" Value = "" />
<Setter Target = "CEight.Width" Value = "Auto" />
<Setter Target = "CNine.Width" Value = "" />
<Setter Target = "CTen.Width" Value = "Auto" />
<Setter Target = "CEleven.Width" Value = "Auto" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Name="Parent" BorderBrush="Silver" BorderThickness="0 0 1 1" >
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="7*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="15*"/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="Cone" Width="10*"/>
<ColumnDefinition x:Name="CTwo" Width="60*"/>
<ColumnDefinition x:Name="CThree" Width="250*"/>
<ColumnDefinition x:Name="CFour" Width="16*"/>
<ColumnDefinition x:Name="CFive" Width="*"/>
<ColumnDefinition x:Name="CSix" Width="23*"/>
<ColumnDefinition x:Name="CSeven"/>
<ColumnDefinition x:Name="CEight" Width="8*"/>
<ColumnDefinition x:Name="CNine"/>
<ColumnDefinition x:Name="CTen" Width="4*"/>
<ColumnDefinition x:Name="CEleven" Width="25*"/>
</Grid.ColumnDefinitions>
<Image Source="Application_Images\circle.png" Stretch="Uniform" Grid.RowSpan="6" Grid.Column="1" Margin="0,0,9,0" HorizontalAlignment="Stretch" Grid.Row="1" VerticalAlignment="Stretch"/>
<Image Source="Application_Images\circle.png" Stretch="Fill" RenderTransformOrigin="-0.057,0.714" Grid.Column="7" Grid.Row="2" Grid.RowSpan="4" Margin="0,3,0,2" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<TextBlock FontSize="14" Text="" TextWrapping="Wrap" Name="TBUserName" Foreground="#27aae1" TextAlignment="right" Grid.Column="5" Margin="3,3,0,0" Grid.RowSpan="3" Grid.Row="2" FontWeight="Bold" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<TextBlock FontSize="13" Text=" Admin" TextWrapping="Wrap" Name="TBRole" Foreground="#414042" TextAlignment="right" Grid.Column="5" Margin="3,1,0,8" RenderTransformOrigin="0.5,0.5" Grid.Row="4" Grid.RowSpan="3" HorizontalAlignment="Stretch" >
<TextBlock.RenderTransform>
<CompositeTransform ScaleY="1"/>
</TextBlock.RenderTransform>
</TextBlock>
<Button Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="9" Margin="0,0,3,6" RenderTransformOrigin="0.5,0.5" Grid.Row="4" Width="6" Height="5">
<Button.RenderTransform>
<CompositeTransform ScaleX="1" ScaleY="1"/>
</Button.RenderTransform>
<Button.Template>
<ControlTemplate>
<Image Stretch="Fill" Source="Application_Images\circle.png"/>
</ControlTemplate>
</Button.Template>
<!--<Image Source="dropdown.png" Margin="9,8,0,4" />-->
<Button.Flyout>
<MenuFlyout x:Name="settings">
<MenuFlyoutItem Text = "Profile" />
<MenuFlyoutItem Text = "Sign Out" />
</MenuFlyout>
</Button.Flyout>
</Button>
<Image ToolTipService.ToolTip="Dashboard" Source="Application_Images\circle.png" Stretch="Uniform" Grid.Column="3" Grid.Row="3" Grid.RowSpan="3" Margin="1,0,0,0" VerticalAlignment="Stretch"/>
<StackPanel Background="#E1E1E1" Grid.Column="4" HorizontalAlignment="Center" Margin="0,1,0,13" Width="1" Grid.RowSpan="5" Grid.Row="2" />
</Grid>
</Grid>
</UserControl>