CellTemplate不是依赖属性,不能绑定DynamicResource

 自己在DataGrid行末添加按钮时遇到了这样的问题,设计的时候DataGrid中显示是有按钮存在的,但是一运行按钮就不见了,试验了好几次都是这样子,经过ktei2008老师的指点才知道问题所在,我当时的代码是这样写的:
                  <DataGrid.Columns>
    			<DataGridTextColumn Binding="{Binding Property1}" Header="Property1"/>
    			<DataGridCheckBoxColumn Binding="{Binding Property2}" Header="Property2"/>
    			<DataGridTemplateColumn Header="功能" CellTemplate="{DynamicResource DataTemplate1}"/>
    		</DataGrid.Columns>


Header为功能的那一列是我要添加的按钮,用的CellTemplate模板,事实上,正如我标题中所写,CellTemplate不是依赖属性,不能绑定DynamicResource,最后的代码是这个样子的:

                  <DataGrid.Columns>
    			<DataGridTextColumn Binding="{Binding Property1}" Header="Property1"/>
    			<DataGridCheckBoxColumn Binding="{Binding Property2}" Header="Property2"/>
    			<DataGridTemplateColumn Header="功能" CellTemplate="{StaticResource DataTemplate1}"/>
    		</DataGrid.Columns>


        

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值