首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ComponentOne DataGridColumnHeaderPresenter样式继承不起作用(Silverlight)

ComponentOne DataGridColumnHeaderPresenter样式继承不起作用(Silverlight)
EN

Stack Overflow用户
提问于 2014-01-07 03:20:25
回答 1查看 467关注 0票数 0

我正在为Silverlight使用ComponentOne C1DataGrid控件。标准StyleInheritance不起作用。以下是代码:

代码语言:javascript
复制
<UserControl x:Class="TestSLStyles.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:sys="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <Style x:Key="BaseStyle" TargetType="Button">
            <Setter Property="Background" Value="Yellow" />
        </Style>
        <Style x:Key="InheritedStyle" TargetType="Button" BasedOn="{StaticResource BaseStyle}">
            <Setter Property="Foreground" Value="Red" />
        </Style>

        <Style x:Key="dchpBase" x:Name="dchpBase" TargetType="c1:DataGridColumnHeaderPresenter">
            <Setter Property="Background" Value="Yellow"/>
        </Style>
        <Style x:Key="dchpInherited" x:Name="dchpInherited" TargetType="c1:DataGridColumnHeaderPresenter" BasedOn="{StaticResource dchpBase}"> 
            <Setter Property="Foreground" Value="Red"/>
        </Style>
    </UserControl.Resources>

    <StackPanel>
        <Button Content="HelloWorld" x:Name="btn1" />
        <Button Content="HelloWorld" x:Name="btn2" Style="{StaticResource BaseStyle}" />
        <Button Content="HelloWorld" x:Name="btn3" Style="{StaticResource InheritedStyle}" />

        <c1:C1DataGrid x:Name="grd1">
            <c1:C1DataGrid.Columns>
                <c1:DataGridTextColumn Header="Column1" x:Name="cln1" />
                <c1:DataGridTextColumn Header="Column2" x:Name="cln2" HeaderStyle="{StaticResource dchpBase}" />
                <c1:DataGridTextColumn Header="Column3" x:Name="cln3" HeaderStyle="{StaticResource dchpInherited}" />
            </c1:C1DataGrid.Columns>
        </c1:C1DataGrid>

    </StackPanel>
</UserControl>

正如您在下面的屏幕上所看到的,此代码对于Button的样式继承很好,但对于网格的列标题则不适用:

最后一列应该是黄色背景和红色前景,但基本风格没有继承。在Silverlight 5和ComponentOne版本4.0.20103.86上进行测试

问题也被发到了ComponentOne的论坛上

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-09-15 06:10:00

这个问题是用C1Silverlight构建解决的: 5.0.20133.381

可以从以下链接下载最新版本:RC1.msi

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20963328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档