English 中文(简体)
确保控制区在多语界面中保持控制
原标题:Make sure control stay in their zone in multilang interface

我有一个我试图用多种语言设计的布局,但随着过渡,会遇到一些障碍。

英语:

""https://i.sstatic.net/CAp4r.jpg" alt="此处输入图像描述"/ >

德语:

""https://i.sstatic.net/MVaNF.jpg" alt="此处的内置图像描述"/"

正如你可以看到复选框在网格中飞来飞去, 我怎么能不与其他控制器发生冲突呢?

谢谢 谢谢

与XAML:

<Grid x:Name="Block" Margin="23,70,24.002,153">
            <Rectangle Fill="#FFDDDDDD" Stroke="#FFD7D7D7" Height="54" VerticalAlignment="Top" RadiusX="2" RadiusY="2"/>
            <Rectangle Fill="#FFE8E8E8" Margin="0,19,0,0" Stroke="#FFD7D7D7"/>
            <Label Height="22" Content="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[Language.settings]}" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="10" FontFamily="Myriad Pro" Foreground="#FF585858"/>
            <TextBox MaxLength="2" x:Name="textTimeMin" Margin="175.145,34.336,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" FontFamily="Myriad Pro" Style="{DynamicResource style1Text}" Height="25.2" HorizontalAlignment="Left" Width="30"/>
            <TextBox MaxLength="2" x:Name="textTimeHour" Margin="132.868,34.336,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" HorizontalAlignment="Left" Width="30" FontFamily="Myriad Pro" Style="{DynamicResource style1Text}" Height="25.2"/>
            <Label Content=":" HorizontalAlignment="Left" Margin="162.868,35,0,0" FontSize="11" Foreground="#FF585858" FontFamily="Myriad Pro" VerticalAlignment="Top"/>
            <Label Content="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[Language.timeOptions1]}" HorizontalAlignment="Left" Margin="6.148,36.332,0,0" VerticalAlignment="Top" FontSize="11" Foreground="#FF585858" FontFamily="Myriad Pro" Height="23.2"/>
            <Label Content="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[Language.timeOptions2]}" HorizontalAlignment="Left" Margin="6.148,67.999,0,52.799" FontSize="11" Foreground="#FF585858" FontFamily="Myriad Pro" Height="23.202"/>
            <Custom:DatePicker x:Name="pickerDate" Margin="134,68.149,188,51.851" d:LayoutOverrides=", Height" FontFamily="Myriad Pro" IsTodayHighlighted="False" Foreground="#FF585858"/>
            <Button x:Name="btnAddTask" Content="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[Language.addTask]}" HorizontalAlignment="Left" Margin="8,0,0,8" VerticalAlignment="Bottom" Style="{DynamicResource style1Btn}" Click="btnAddTask_Click" Height="24.65"/>
            <CheckBox x:Name="checkIgnoreDate" Content="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[Language.ignoreDate]}" HorizontalAlignment="Right" Margin="0,0,105,55.706" VerticalAlignment="Bottom" Foreground="#FF585858" Background="{x:Null}" Checked="checkIgnoreDate_Checked" Unchecked="checkIgnoreDate_Unchecked" Height="15.96"/>
            <Rectangle x:Name="ignoreDateStrike" Fill="#FF444444" Height="1" Margin="6.148,0,199.32,64" VerticalAlignment="Bottom" Visibility="Collapsed"/>
            <Button x:Name="btnNow" Content="{Binding Source={StaticResource localisation}, Mode=OneWay, Path=.[Language.now]}" Margin="206.088,34.27,176.585,0" VerticalAlignment="Top" Style="{DynamicResource style1Btn}" Height="25.2" FontSize="9.333" Click="btnNow_Click"/>
        </Grid>
最佳回答

根据你的截图和代码, 你可以有几种不同的方式来解决这个问题。

我建议使用三列三行的网格,以自动显示列的大小。 这样可以确保所有东西都排列得整齐,适合你,不管你田地的长度有多长。

""https://i.sstatic.net/nG3BW.png" alt="此处输入图像描述"/ >

您的电网代码会看起来是这样的:

<Grid x:Name="Block">
<Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition Height="Auto" />
    <RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
...   
</Grid>

然后,你只需要为网格内每个项目设置一个合适的行和列,而不是硬编码它们的边距。

   <Button x:Name="btnAddTask" Grid.Row="1" .... />
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签