DataGrid样式没有绑定。用于类型' DataGridRow'无法应用于类型' DataGridRow'

时间:2014-10-24 01:35:05

标签: c# wpf xaml datagrid styles

我有一个像我这样初始化的DataGrid:

<Custom:DataGrid HorizontalAlignment="Left" Margin="30,100,0,45" Width="420" AutoGenerateColumns="False" RowBackground="Transparent" RowHeaderWidth="0"
                                     Background="#FFEFEFEF" Foreground="{DynamicResource LabelForeground}" ItemContainerStyle="{DynamicResource StyleA}"
                                     ColumnHeaderStyle="{DynamicResource ColumnHeaderStyleA}"
                                     CellStyle="{DynamicResource CellStyleA}" IsReadOnly="True" IsSynchronizedWithCurrentItem="True"
                                     ItemsSource="{Binding ItemList}"  SelectionMode="Extended" ScrollViewer.CanContentScroll="True"
                                      CanUserSortColumns="True">
        <Custom:DataGrid.Columns>
            <Custom:DataGridTemplateColumn Header="{Binding GrdDenomination,Source={StaticResource LiteralDictionary }}" Width="Auto" CellTemplate="{StaticResource DenominationTemplate}" SortMemberPath="Denomination"/>
        </Custom:DataGrid.Columns>
    </Custom:DataGrid>

我的Style初始化为:

<Style x:Key="StyleA" TargetType="{x:Type DataGridRow}" >
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="IsSelected" Value="{Binding Mode=TwoWay, Path=IsSelected}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridRow}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="OnMouseDown1"/>
                    </ControlTemplate.Resources>
                    <ControlTemplate.Triggers>
                    .....
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
</Style>

我收到以下错误:

  

&#34;用于类型&#39; DataGridRow&#39;无法应用于类型&#39; DataGridRow&#39;。&#34;

这对我来说毫无意义,我不确定我在这里做错了什么。任何帮助,将不胜感激。谢谢!

0 个答案:

没有答案