在C1DataGrid中,我们在.xaml文件中定义需要显示在列表中的列,绑定复选框、下拉、时间控件等,代码如下所示。
C1FlexGrid的随机示例中,绑定的列以及数据,都是在后台方法中处理的;请问在C1FlexGrid中,有没有类似下面代码所示的实现方式,来绑定复选框、下拉、时间控件等?
- <c1:C1DataGrid ItemsSource="{Binding List,Mode=TwoWay}" SelectedItem="{Binding CurrentModel, Mode=TwoWay}">
- <c1:C1DataGrid.Columns>
- <c1:DataGridCheckBoxColumn Header="选择" Binding="{Binding IsSelected}"/>
- <c1:DataGridTextColumn Header="层数" Binding="{Binding Layer}" IsReadOnly="True"/>
- <c1:DataGridTemplateColumn Header="类型" Width="60">
- <c1:DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Name="StackPanel" VerticalAlignment="Center" Margin="10,0,0,0">
- <TextBlock VerticalAlignment="Center" Cursor="Hand" Name="ParameterItem" Text="{Binding PriceTypeStr}"/>
- </StackPanel>
- </DataTemplate>
- </c1:DataGridTemplateColumn.CellTemplate>
- <c1:DataGridTemplateColumn.CellEditingTemplate>
- <DataTemplate>
- <c1:C1ComboBox DisplayMemberPath="name" SelectedValuePath="value"
- ItemsSource="{Binding PriceTypeList}"
- SelectedValue="{Binding PriceType, Mode=TwoWay}"/>
- </DataTemplate>
- </c1:DataGridTemplateColumn.CellEditingTemplate>
- </c1:DataGridTemplateColumn>
- <c1:DataGridTextColumn Header="价格" Binding="{Binding Price}"/>
- <c1:DataGridDateTimeColumn Header="时间" Binding="{Binding CrateTime}" EditMode="DateTime" AllowNull="True"/>
- </c1:C1DataGrid.Columns>
- </c1:C1DataGrid>
复制代码 |