Xceed single click checkbox

I apologize for not writting sooner,  I was far away from the wpf/silverlight world. Been stuck with a winform project. Thanks God is over.

The latest version of Xceed Datagrid has a lot of goodies. One of the is the single click checkbox.  If we are using a DataGridCollectionView as our dataitem, all we need to do to present the checkbox is declare the itemgrid property of type boolean.

<xceed:DataGridCollectionViewSource x:Key="dgGridSource"
                                         Source="{Binding}">
 <xceed:DataGridCollectionViewSource.ItemProperties>
                <xceed:DataGridItemProperty Name="Name"
    IsReadOnly="True"  ValuePath="Name"    />
                <xceed:DataGridItemProperty Name="Age"
    IsReadOnly="True" ValuePath="Age"   />
                <xceed:DataGridItemProperty Name="Male"
    DataType="{x:Type System:Boolean}"
    IsReadOnly="False" ValuePath="IsMale" />
 </xceed:DataGridCollectionViewSource.ItemProperties>
</xceed:DataGridCollectionViewSource>

 The importan line here is as the DataType attribute. DataType=”{x:Type System:Boolean}”.  In order to have access to the System namespace we need to add this reference to our control. 

 xmlns:System=”clr-namespace:System;assembly=mscorlib”

Then to get the single click editing we need to set the following attributes to the xceed datagrid. EditTrigger and CellEditorDisplayConditions.

<xceed:DataGridControl    x:Name="dgGrid"
                                ItemsSource="{Binding}"
                                EditTriggers="SingleClick"
                                CellEditorDisplayConditions="MouseOverCell"
                               >
</<xceed:DataGridControl>
That's it.  

~ by ajhorus on October 24, 2008.

Leave a Reply