2012-05-23 57 views
0

我有一個佈局,我試圖使多語言,但與過渡來了一些障礙。確保控制留在他們的multilang接口的區域

英語:

enter image description here

德國:

enter image description here

正如你所看到的複選框網格飛舞着,我怎麼能解決這不與其它控制衝突?

感謝

編輯使用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> 
+0

這取決於您使用的佈局種類。流體佈局(使用WPF很容易),它應該改變其位置而不重疊。如果你使用的是畫布,那麼你會遇到這種東西的所有麻煩... –

+0

我已經添加了我用於我的佈局,任何建議的XAML? –

+0

請勿爲您的佈局使用邊距。有很多選項,您可以使用網格或易於使用的StackPanel來堆疊每行,然後堆疊每行控件。 _bad_是你必須改變你的(代碼)佈局很多... –

回答

1

鑑於你的截圖和代碼,有幾種不同的方式,你可以去這個問題。

我會推薦使用三欄和三行的網格,其中列是自動化的。這將確保所有事情都很好地排列起來,無論你的領域多長時間都適合。

enter image description here

網格代碼將是這個樣子:

<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" .... />