ContentDialog behavior difference with Creators Update

172 views Asked by At

I have a scenario where I change the size of a content dialog in the view model. This works fine in the AnniversaryUpdate, but with the Creators Update, I get a totally different (and unworkable) behavior.

I have a content dialog where I want to change the screen size from portrait to landscape based on user input. In build 14393 (anniversary) it works just fine. When I toggle the project to use the Creators Update (150630) it does not work at all.

Here is the XAML code driving the issue:

<ContentDialog
x:Class="DialogView"
...snip...
Background="LightGray"
MinHeight="{Binding GridHeight}" MinWidth="{Binding GridWidth}">

<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <Grid Background="AliceBlue" Visibility="Collapsed"/>
    <Button Content="{Binding Orientation}" Height="40" Click="ToggleButton_Click" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</Grid>

When I run built for the Creators Update, I get a very small dialog that will not change size.

1

There are 1 answers

0
Jayden On

The default style for Windows.UI.Xaml.Controls.ContentDialog in 14393 is different from the default style for Windows.UI.Xaml.Controls.ContentDialog in 15063.

In the default style for Windows.UI.Xaml.Controls.ContentDialog in 15063, it use ContentDialogMinHeight and ContentDialogMinWidth to set the MinHeight and MinWidth. And the default value of ContentDialogMinHeight and ContentDialogMinWidth are 184 and 320.

When you set the value to MinHeight and MinWidth property in the ContentDialog control, it will not change the value that define in the style.

In 14393, it does not define the MinHeight and MinWidth in the default style. If you want to get the same MinHeight and MinWidth as 14393 in 15063, you should be able to copy the default style in 15063 and remove the following code:

<Setter Property = "MinHeight" Value="{ThemeResource ContentDialogMinHeight}" />
<Setter Property = "MinWidth" Value="{ThemeResource ContentDialogMinWidth}" />