callisto
callisto copied to clipboard
CustomDialog not updating layout on SizeChanged
when the app is snnaped o change Orientation CustomDialog is not updated layout
What layout do you expect to update? The content is within a grid that auto-sizes.
I have the same issue. I'm trying the Callisto TestApp. If I show the Custom Dialog and then snap the app, the dialog doesn't auto-size: the text doesn't wrap and I can't see the buttons. Here is a screenshot:
You can just do something like this in code behind. Then the contentGrid will resize always.
public CustomMessageDialog() { this.InitializeComponent(); DetermineVisualState(ApplicationView.Value); Window.Current.SizeChanged += Current_SizeChanged; }
void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
{
DetermineVisualState(ApplicationView.Value);
}
private void DetermineVisualState(ApplicationViewState viewState)
{
switch (viewState)
{
case ApplicationViewState.FullScreenLandscape:
contentGrid.MinWidth = 685;
contentGrid.Width = 685;
break;
case ApplicationViewState.Filled:
contentGrid.MinWidth = 685;
contentGrid.Width = 685;
break;
case ApplicationViewState.Snapped:
contentGrid.MinWidth = 280;
contentGrid.Width = 280;
break;
case ApplicationViewState.FullScreenPortrait:
contentGrid.MinWidth = 685;
contentGrid.Width = 685;
break;
default:
contentGrid.MinWidth = 685;
contentGrid.Width = 685;
break;
}
}
<Grid MinWidth="685" x:Name="contentGrid" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock x:Name="content" FontSize="14.6667" FontWeight="SemiLight" TextWrapping="Wrap"/>
<StackPanel Grid.Row="1" x:Name="buttons" HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal"
Margin="0,30,10,0"/>
</Grid>