如何在 DataGrid 中设置行标题列的样式

发布于 2024-12-24 17:26:09 字数 180 浏览 0 评论 0原文

我正在使用 ComponentOne C1DataGrid。除了行标题列之外,我已经能够对其进行完整的样式设置。

如何在 XAML 中设置它的样式?

你可以看到图像: 此处 谢谢, 弗洛特

I am using ComponentOne C1DataGrid. I have been able to style it to the full extent except row header column.

How can I style it in XAML?

You can see the image:
here
Thanks,
flot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥有 2024-12-31 17:26:09

回答我自己的问题,以防其他人感兴趣:

有一个特殊的演示者,DataGridRowHeaderPresenter,可以设置样式。
我想用树状的“+”和“-”符号替换标准的行详细信息切换,我这样做了,如下所示:

    <Style x:Key="DataGridRowHeaderStyle2" TargetType="{x:Type c1:DataGridRowHeaderPresenter}">
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type c1:DataGridRowHeaderPresenter}">
                <!-- BulletDecorator is used to provide baseline alignment between the sign and the Content -->
                <BulletDecorator Background="#BFEFF2F5">
                    <BulletDecorator.Bullet>
                        <Grid Width="13" Height="13">
                            <Image Name="sign" Source="/myControls;component/Resources/Images/plus.png" />
                        </Grid>
                    </BulletDecorator.Bullet>
                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                </BulletDecorator>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsSelected" Value="true">
                        <Setter Property="Source"  Value="/myControls;component/Resources/Images/minus.png"  TargetName="sign"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Answering my own question in case somebody else is interesting:

There is a special presenter, DataGridRowHeaderPresenter, that can be styled.
I wanted to replace a standard row details toggle with the tree-like "+" and "-" signs and I did it as follows:

    <Style x:Key="DataGridRowHeaderStyle2" TargetType="{x:Type c1:DataGridRowHeaderPresenter}">
    <Setter Property="FontWeight" Value="Bold" />
    <Setter Property="FontSize" Value="12" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type c1:DataGridRowHeaderPresenter}">
                <!-- BulletDecorator is used to provide baseline alignment between the sign and the Content -->
                <BulletDecorator Background="#BFEFF2F5">
                    <BulletDecorator.Bullet>
                        <Grid Width="13" Height="13">
                            <Image Name="sign" Source="/myControls;component/Resources/Images/plus.png" />
                        </Grid>
                    </BulletDecorator.Bullet>
                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                </BulletDecorator>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsSelected" Value="true">
                        <Setter Property="Source"  Value="/myControls;component/Resources/Images/minus.png"  TargetName="sign"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文