内容对话框最大宽度 [英] ContentDialog max width

查看:30
本文介绍了内容对话框最大宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试像这样在我的应用程序中创建一个设置菜单

I'm trying to create a settings menu in my app like this

我知道怎么做,但是内容对话框的宽度有问题,显然宽度有限制.

I know how to do it but I have a problem with the width on content dialog, apparently there is a limit on width.

这是我的内容对话框的代码:

Here's code for my content dialog:

Title="" Margin="12,0,-12,0" HorizontalAlignment="Stretch" Width="800" Height="600" VerticalAlignment="Stretch" Background="{x:Null}">
<Grid x:Name="Main" ScrollViewer.VerticalScrollBarVisibility="Auto" Width="800">
    <Grid.RowDefinitions>
        <RowDefinition Height="58"/>
        <RowDefinition Height="58"/>
        <RowDefinition/>
        <RowDefinition Height="76"/>
    </Grid.RowDefinitions>
    <TextBox x:Name="Title_TextBox" Text="" Margin="10,10,10,0" PlaceholderText="Please enter your story title..." RequestedTheme="Light" FontSize="16" MaxLength="50" Grid.Row="1" />
    <TextBox x:Name="Experience_Text" Text="" Grid.Row="2" Margin="10,10,10,0"  PlaceholderText="Please tell your experience..." MaxLength="500" FontSize="16" TextWrapping="Wrap" MinHeight="42" AcceptsReturn="True" RequestedTheme="Light" ScrollViewer.VerticalScrollBarVisibility="Auto" VerticalAlignment="Center" Height="190" />
    <Grid x:Name="CharacterGrid" Grid.Row="3" Margin="10,0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="48"/>
            <ColumnDefinition Width="64"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <TextBlock x:Name="CharacterLeft" Margin="0" TextWrapping="Wrap" Text="" TextAlignment="Right" FontSize="16" Grid.Column="2" VerticalAlignment="Top" RequestedTheme="Light" />
        <Button x:Name="CameraButton" FontFamily="Segoe MDL2 Assets" Content="&#xE722;" Background="Transparent" VerticalAlignment="Top" Margin="0,5,0,0" HorizontalAlignment="Left" FontSize="21.333" RequestedTheme="Light" Width="48" Height="48"/>
    </Grid>
    <Grid x:Name="LocationGrid" Margin="10,10,10,0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="48"/>
        </Grid.ColumnDefinitions>
        <TextBlock x:Name="LocText" Margin="0" TextWrapping="Wrap" Text="Location will be here...." FontSize="16" VerticalAlignment="Center" RequestedTheme="Light" TextAlignment="Center"/>
        <Button x:Name="LocationButton" FontFamily="Segoe MDL2 Assets" Content="&#xE81D;" Background="Transparent" VerticalAlignment="Center" Margin="0" HorizontalAlignment="Right"  FontSize="21.333" RequestedTheme="Light" Width="48" Height="48" Grid.Column="1"/>
    </Grid>
</Grid>

推荐答案

我所要做的就是在初始化组件之后添加这段代码

All that I Have to do is just add this code after the initialize component

this.width = Window.Current.Bounds.Width;

内容对话框将获得您的屏幕宽度..谢谢大家希望这能帮助任何人搜索它!

and the content dialog will get your screen width.. thanks everyone hope this will help anyone search for it !

这篇关于内容对话框最大宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆