无法从应用程序访问两种样式

时间:2013-06-24 12:29:00

标签: wpf xaml wpfdatagrid

 <Style x:Key="Body_Content_DataGrid_Centering"
        TargetType="{x:Type DataGridCell}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                        <Grid Background="{TemplateBinding Background}">
                            <ContentPresenter VerticalAlignment="Center" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="CellFocusVisual" TargetType="{x:Type DataGridCell}">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border>
                            <Rectangle StrokeThickness="0.5" Stroke="DarkGray"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

我想调用Datagrid中的两个样式CellStyle是否可以在App.XAML的WPF DataGrid中调用。显示错误,如下所示。

enter image description here

0 个答案:

没有答案