我有下面的主题模板为ListViewItems
,但里面的RichTextBox
垂直显示文本。如何编辑RichTextBox
,使文本水平显示?
<Style TargetType="ListViewItem" x:Key="InformationListItemTheme">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="175"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"/>
<RichTextBox Grid.Column="1" Height="275"/>
<Grid Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Text="JA"/>
<TextBlock Grid.Column="0" Grid.Row="1" Text="SCH"/>
<TextBlock Grid.Column="0" Grid.Row="2" Text="ELT"/>
<TextBlock Grid.Column="0" Grid.Row="3" Text="KIN"/>
<TextBlock Grid.Column="0" Grid.Row="4" Text="SON"/>
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding JA}"/>
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding SCH}"/>
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding ELT}"/>
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding KIN}"/>
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding SON}"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
1条答案
按热度按时间ggazkfy81#
我做了一个可重复的例子。
正如您在这个例子中看到的,RichTextBox并没有使用变量列的整个宽度。RichTextBox保持较小,但应与列一样大。这里有什么问题?我应该把RichTextBox的宽度绑定到什么东西上吗?
感谢您的评分