Checkbutton里面的TextBox没有包装

时间:2016-02-18 16:15:13

标签: c# wpf checkbox textbox word-wrap

我有一个listBox,其中包含一个文本块内的复选框:

<ListBox x:Name="lbxtgbTab3"  FontSize="{StaticResource BUTTON_FONTSIZE}"  HorizontalContentAlignment="Stretch"  Background="{x:Null}" BorderBrush="{x:Null}" FontWeight="Bold">
  <ToggleButton  Name="tgb4Tab3" Background="{x:Null}" Height="{StaticResource BUTTON_HEIGHT}" Click="ToggleButton_Click" Padding="0" FontWeight="Bold">
            <TextBlock Name="otb4Tab3" Text="4 - GESTIONE P.P." Margin="0" Background="Red" TextAlignment="Center" TextWrapping="Wrap"/>
  </ToggleButton>

现在的问题是它没有包装,如图所示

enter image description here

- 编辑 -

我已经改变了它

<ToggleButton  Name="tgb4Tab3"  Background="{x:Null}" Height="{StaticResource BUTTON_HEIGHT}" HorizontalAlignment="Left" Width="175" Padding="0" BorderBrush="Gainsboro" BorderThickness="3" IsChecked="false" Click="ToggleButton_Click" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="0">
  <TextBlock Name="otb4Tab3" Text="4 - GESTIONE P.P." Margin="0" Fill="White" TextAlignment="Center" TextWrapping="Wrap" />
</ToggleButton>

但没有变化

1 个答案:

答案 0 :(得分:0)

一种解决方案是指定ListBox的宽度或ToggleButton的宽度。如果你没有指定尺寸,乳清会认为它们有无限的增长空间。也许如果你展示一个完整的XAML例子可以更容易回答。

一个解决方案可能是:

public interface Parameter {
    public void process(Entity entity, Object obj, YamlConfiguration yml, String module);
}


// Somewhere else
Map<String, Parameter> parameters = ... // Initialise it with yours, allow the user to add their own

parameters.get(param.getKey()).process(entity, param.getValue(), yml, module);
相关问题