wpf datagridcheckbox列样式 [英] wpf datagridcheckboxcolumn style

查看:105
本文介绍了wpf datagridcheckbox列样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想象一下,我有一个名为 MyCheckBoxStyle的CheckBox自定义样式。

Imagine I have a CheckBox custom style named "MyCheckBoxStyle".

如何创建一个基于MyCheckBoxStyle嵌入自定义DataGridCheckBoxColumn样式的Datagrid样式?

How can I make a Datagrid style that embeds a custom DataGridCheckBoxColumn style based on my MyCheckBoxStyle?

推荐答案

您可以使用DataGridTemplateColumn创建自定义复选框box

You can use DataGridTemplateColumn to create a custom checkboxcolumn

                                <Custom:DataGridTemplateColumn x:Name="gdchk" Header="Test" MaxWidth="50">
                                <Custom:DataGridTemplateColumn.CellTemplate >
                                    <DataTemplate>
                                        <CheckBox IsChecked="{Binding Path = classname}" HorizontalAlignment="Center" Style="{DynamicResource myCheckBoxStyle}"/>
                                    </DataTemplate>
                                </Custom:DataGridTemplateColumn.CellTemplate>
                            </Custom:DataGridTemplateColumn>

希望这会有所帮助。

这篇关于wpf datagridcheckbox列样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆