2014-01-07 2 views
0

Я использую элемент управления ComponentOne C1DataGrid для Silverlight. Стандартный стильInheritance не работает. Вот код:ComponentOne DataGridColumnHeaderPresenter Стиль Наследование не работает (Silverlight)

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

Как вы можете видеть на экране ниже, этот код работает отлично для стиля наследования Баттона, но не для заголовка столбца решетки в:

enter image description here

В последней колонке предполагалось быть на желтом фоне и на красном переднем плане, но базовый стиль не наследуется. Проверено на Silverlight 5 и ComponentOne версии 4.0.20103.86

Question was posted to ComponentOne's forum as well

+0

то же самое с последней версией. Пожалуйста, спросите также на наших форумах поддержки: http://our.componentone.com/groups/forum/xaml/studio-for-silverlight/, позвольте нашей поддержке, чтобы копаться в нем – notacat

+0

сделано, добавлена ​​ссылка –

ответ

Смежные вопросы