callisto icon indicating copy to clipboard operation
callisto copied to clipboard

CustomDialog not updating layout on SizeChanged

Open retupmoc opened this issue 12 years ago • 3 comments

when the app is snnaped o change Orientation CustomDialog is not updated layout

retupmoc avatar Dec 30 '12 22:12 retupmoc

What layout do you expect to update? The content is within a grid that auto-sizes.

timheuer avatar Dec 30 '12 22:12 timheuer

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:

screenshot_02102013_030739

marcominerva avatar Feb 10 '13 02:02 marcominerva

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>

Knoerzer avatar Jun 26 '13 07:06 Knoerzer