0
我正在自定義項目中的DataGridRowGroupHeader。一切工作正常,但我不能讓文本修剪。SL4 - DataGridRowGroupHeader中的TextTrimming
這裏的風格:
<sdk:DataGrid.RowGroupHeaderStyles>
<Style TargetType="sdk:DataGridRowGroupHeader">
<Setter Property="Cursor" Value="Arrow" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="20"/>
<Setter Property="Margin" Value="18,0,20,0"/>
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="sdk:DataGridRowGroupHeader">
<Grid Name="Root"
Margin="{TemplateBinding Margin}"
Background="{TemplateBinding Background}"
HorizontalAlignment="Stretch"
>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CurrentStates">
<VisualState x:Name="Regular"/>
<VisualState x:Name="Current">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border BorderBrush="Yellow" BorderThickness="1" Visibility="Visible">
<TextBlock x:Name="txbGroupingName"
Margin="4,0,0,0"
Text="{Binding Name}"
FontSize="13"
TextTrimming="WordEllipsis"
HorizontalAlignment="Left"
Style="{StaticResource OrangeBodyText}"
/>
</Border>
<Rectangle Name="FocusVisual"
Stroke="{StaticResource BorderFocusBrush}"
StrokeThickness="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="false"
Opacity="0" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</sdk:DataGrid.RowGroupHeaderStyles>
在TextBlock的txbGroupingName文本將不修剪,它似乎像它應該就好了。
在此先感謝!