Silverlight中 Content="{TemplateBinding Content}" bug

开发中遇到运行指定页面时一片空白,逐步查是ControlTemplateTargetType指定就可以了。

    <Style x:Key="HeaderStyle" TargetType="sdk:DataGridColumnHeader" >
        <Setter Property="Foreground" Value="#FF000000" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="sdk:DataGridColumnHeader">
                    <ContentPresenter Content="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

posted @ 2012-03-29 17:49  正文  阅读(671)  评论(0编辑  收藏  举报