bug*_*d87 16
实际上,比修改模板更简单的XAML解决方案.在这种情况下,不要使用Expander的头属性.而是使用您自己的样式TextBlock覆盖扩展器.
<Application.Resources>
<Style x:Key="ExpanderHeader" TargetType="{x:Type TextBlock}">
<Setter Property="Height" Value="22" />
<Setter Property="Margin" Value="21,0,0,0" />
<Setter Property="Padding" Value="9,3,0,0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
</Application.Resources>
<Grid>
<Expander>
<TextBlock Text="I am some content. I have disowned my default header." Margin="10,5" />
</Expander>
<TextBlock Text="I'm filling in for the default header. You'll like me better anyway."
Style="{StaticResource ResourceKey=ExpanderHeader}"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
15662 次 |
最近记录: |