DevExpress中自定义CellTemplate数据绑定不显示的问题
来源:互联网 发布:淘宝上的驱鼠器 编辑:程序博客网 时间:2024/04/29 03:03
定义Student类,其中有布尔值属性IsNormal和IsLate,View中使用DevExpress的GridControl,将两个布尔值放入一个单元格中,以RadioButton显示,需要自定义CellTemplate,但是当进行RadioButton的Checked属性和两个布尔值进行绑定的时候总是出错,原来是数据并没有绑过去,正确的绑定方式应该是,注意
Binding RowData.Row.IsNormal
<dxg:GridControl Name="datagrid" AutoGenerateColumns="None" ShowBorder="False" CurrentItem="{Binding CurrentItem,Mode=TwoWay}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" ItemsSource="{Binding Students}"> <dxg:GridControl.View> <dxg:TableView AutoWidth="True" AllowEditing="True"/> </dxg:GridControl.View> <dxg:GridControl.Columns> <dxg:GridColumn Header="学号" Binding="{Binding Sid,Mode=TwoWay}"/> <dxg:GridColumn Header="姓名" Binding="{Binding Sname,Mode=TwoWay}"/> <dxg:GridColumn Header="性别" Binding="{Binding Sgender,Mode=TwoWay}"/> <dxg:GridColumn Header="班级" Binding="{Binding Sclass,Mode=TwoWay}"/> <dxg:GridColumn Header="状态"> <dxg:GridColumn.CellTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=dockPanel,Path=DataContext.BeforeItemsVisibility,Mode=TwoWay}"> <RadioButton Content="出勤" IsChecked="{Binding RowData.Row.IsNormal,Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Checked"> <i:InvokeCommandAction Command="{Binding ElementName=dockPanel,Path=DataContext.NormalCommand}" CommandParameter="{Binding ElementName=datagrid}"/> </i:EventTrigger> </i:Interaction.Triggers> </RadioButton> <RadioButton Content="迟到" IsChecked="{Binding RowData.Row.IsLate,Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Checked"> <i:InvokeCommandAction Command="{Binding ElementName=dockPanel,Path=DataContext.LateCommand}" CommandParameter="{Binding ElementName=datagrid}"/> </i:EventTrigger> </i:Interaction.Triggers> </RadioButton> <RadioButton Content="请假" IsChecked="{Binding RowData.Row.IsReasonable,Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Checked"> <i:InvokeCommandAction Command="{Binding ElementName=dockPanel,Path=DataContext.ReasonableCommand}" CommandParameter="{Binding ElementName=datagrid}"/> </i:EventTrigger> </i:Interaction.Triggers> </RadioButton> <RadioButton Content="旷课" IsChecked="{Binding RowData.Row.IsAbsent,Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Checked"> <i:InvokeCommandAction Command="{Binding ElementName=dockPanel,Path=DataContext.AbsentCommand}" CommandParameter="{Binding ElementName=datagrid}"/> </i:EventTrigger> </i:Interaction.Triggers> </RadioButton> </StackPanel> <StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=dockPanel,Path=DataContext.AfterItemsVisibility,Mode=TwoWay}"> <RadioButton Content="早退" IsChecked="{Binding RowData.Row.IsLeaved,Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Checked"> <i:InvokeCommandAction Command="{Binding ElementName=dockPanel,Path=DataContext.LeavedCommand}" CommandParameter="{Binding ElementName=datagrid}"/> </i:EventTrigger> </i:Interaction.Triggers> </RadioButton> <RadioButton Content="正常" IsChecked="{Binding RowData.Row.IsRight,Mode=TwoWay}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Checked"> <i:InvokeCommandAction Command="{Binding ElementName=dockPanel,Path=DataContext.RightCommand}" CommandParameter="{Binding ElementName=datagrid}"/> </i:EventTrigger> </i:Interaction.Triggers> </RadioButton> </StackPanel> </StackPanel> </DataTemplate> </dxg:GridColumn.CellTemplate> </dxg:GridColumn> </dxg:GridControl.Columns> </dxg:GridControl>参考网址https://www.devexpress.com/Support/Center/Question/Details/Q341304
0 0
- DevExpress中自定义CellTemplate数据绑定不显示的问题
- 母版页中数据绑定控件不显示数据的问题
- Devexpress中ASPxTreeView绑定数据,显示三级菜单的写法(用存储过程调取)
- DevExpress ASPxComboBox数据绑定问题
- DevExpress Report web 绑定数据后没有显示的解决方法
- DevExpress 中的gridControl1 中主从表的数据绑定
- DevExpress中GridControl的重新绑定数据后如何刷新
- 解决DevExpress控件在工具箱不显示的问题
- vs2010中工具箱不显示DevExpress控件的解决办法
- angularjs的uigrid中celltemplate如何显示scope里的内容
- DevExPress控件中ComboBoxEdit动态绑定数据
- DevExpress中XtraGrid主从表数据显示的简单实现
- DEVExpress XtraReport报表制作过程中绑定数据源的XRControl对象在值为0时不显示功能,通过代码自动实现
- DevExpress报表的数据绑定及打印
- php中simplexml_load_file中CDATA数据不显示的问题
- DevExpress lookupedit下拉列表不显示内容的问题和其它问题
- DevExpress:grid中绑定下拉框ComboBoxEdit,只带显示
- DevExpress中XtraTreeList的父子(层次)关系数据的绑定
- javase基础之 集合框架概述
- 数据结构与算法分析-01 起步
- 3.11周二 概率 离散
- 解决Access denied for user 'walter'@'localhost' (using password: YES)
- Tyvj 1055 沙子合并 DP
- DevExpress中自定义CellTemplate数据绑定不显示的问题
- C#中深复制的几种方法
- 生成一定范围内的互不相同的随机数的方法比较
- Sublime Text 2 编译C++ C# Python
- 火狐的配置(超好的阅读模式等功能)
- SQL Server数据库无法启动(万金油解决办法)
- POJ1979
- java反射机制
- 六款最主流的免费网络嗅探软件全接触