内容对话框不会更改其大小

时间:2017-06-18 12:08:08

标签: c# xaml uwp

我有一个内容对话框,无论我给它的任何选项(宽度,高度,全屏)似乎都不会超过一定的宽度。 这是内容对话框的XAML:

<ContentDialog x:Name="CntdCommand" Title="Comanda" FullSizeDesired="True">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>

                <Grid Grid.Row="0" Grid.Column="0">
                    <ListView ItemsSource="{Binding SelectedHallTable.Command.CommandItems}">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Border Width="48" Height="48">
                                        <Image Source="../Assets/LoginBackground.jpg" Stretch="UniformToFill"/>
                                    </Border>
                                    <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0">
                                        <TextBlock Text="{Binding Product.Name}"></TextBlock>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="Cantitate: "></TextBlock>
                                            <TextBlock Text="{Binding Quantity}"></TextBlock>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="Total: "></TextBlock>
                                            <TextBlock Text="{Binding Total}"></TextBlock>
                                        </StackPanel>
                                    </StackPanel>
                                </Grid>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </Grid>

                <Grid Grid.Row="0" Grid.Column="1">
                    <Pivot ItemsSource="{Binding ProductGroups}" SelectedItem="{Binding SelectedProductGroup, Mode=TwoWay}">

                        <Pivot.ItemTemplate>
                            <DataTemplate x:DataType="views:ProductGrouping">

                                <GridView ItemsSource="{x:Bind}">

                                    <!--<GridView.GroupStyle>
                                        <GroupStyle HeaderTemplate="{StaticResource MenuHeaderTemplate}" />
                                    </GridView.GroupStyle>-->

                                    <GridView.ItemTemplate>
                                        <DataTemplate x:DataType="viewModels:ProductDTOViewModel">
                                            <Grid>
                                                <StackPanel Padding="10">
                                                    <Image Source="../Assets/LoginBackground.jpg" Width="64" Height="64" />
                                                    <TextBlock Text="{x:Bind Name}"/>
                                                    <TextBlock Text="{x:Bind EAN}"/>
                                                </StackPanel>
                                            </Grid>
                                        </DataTemplate>
                                    </GridView.ItemTemplate>

                                </GridView>

                            </DataTemplate>
                        </Pivot.ItemTemplate>

                    </Pivot>
                </Grid>

                <Grid Grid.Row="1" Grid.Column="0">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Total: "></TextBlock>
                        <TextBlock Text="{Binding SelectedHallTable.Command.Total}"></TextBlock>
                    </StackPanel>
                </Grid>

                <Grid Grid.Row="1" Grid.Column="1">
                    <CommandBar DefaultLabelPosition="Right">
                        <AppBarButton Icon="Delete" Label="Sterge" />
                        <AppBarSeparator></AppBarSeparator>
                        <AppBarButton Icon="Send" Label="Trimite" />
                        <AppBarButton Icon="Accept" Label="Incaseaza" />
                    </CommandBar>
                </Grid>

            </Grid>
        </ContentDialog>

这就是结果的样子: enter image description here

我试图改变它的宽度和高度,但它没有做任何事情,任何帮助将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:0)

设置MaxWidth并且它应该可以工作