文本块在Expander.Header中不工作
我得到了System.Window.Control.TextBlod
<Expander Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="expMainInstructions"
MaxHeight="400"
Style="{StaticResource ExpanderHelp}">这行得通
<Expander.Header>khjasdf</Expander.Header>这做了而不是的工作,我也尝试了Expander.Header.Content
<Expander.Header>
<TextBlock>Instructions</TextBlock>
</Expander.Header>发布于 2014-10-14 13:08:27
您没有发布ExpanderHelp样式,但是您所遇到的问题会提示您创建自定义Template,并使用TextBlock而不是ContentPresenter来表示Header。如果是这样的话,您在Header中的任何内容都将被转换为string。
<ControlTemplate TargetType="{x:Type Expander}">
<!-- .... -->
<ContentPresenter ContentSource="Header"/>
<!-- .... -->
</ControlTemplate>https://stackoverflow.com/questions/26361182
复制相似问题