Question

I'm using ComponentOne C1DataGrid control for Silverlight. Standard StyleInheritance does not work. Here is the code:

<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>

As you can see on screen below, this code works fine for Button's style inheritance, but not for grid's column header:

enter image description here

The last column supposed to be with Yellow background and Red foreground, but base style is not inherited. Tested on Silverlight 5 and ComponentOne version 4.0.20103.86

Question was posted to ComponentOne's forum as well

Was it helpful?

Solution

The issue was fixed with the C1Silverlight Build : 5.0.20133.381

The latest build can be downloaded from the following link :http://prerelease.componentone.com/hotfixes/silverlight/C1Silverlight_5.0.20141.399_RC1.msi

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top