Home Forums WPF controls Xceed DataGrid for WPF Identifying a CheckBox type in the DataGrid

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23640 |

    I am having trouble identifying a CheckBox type within the DataGridControl for styles. I am looking to set a style for a CheckBox to HorizontalContentAlignment to Center within a DataGridControl property without having to set the x:Key name, as I am binding an Observable Collection and I don’t want to specify the style elements individually but by TargetType.

    I was thinking that the TargetType will need to be and xceed:DataCell and then a trigger will be set for the DataCell type of CheckBox but I haven’t had any luck so far… any suggestions?

    thanks

    Imported from legacy forums. Posted by Rob (had 1811 views)

    Xceed Support
    Member
    Post count: 5658

    I do not understand what you desire, can you rephrase what it is you want to do?

    Imported from legacy forums. Posted by Marcus [Xceed] (had 201 views)

    User (Old forums)
    Member
    Post count: 23064

    Not sure if this is the same question but i would like to know how to center the checkbox in a column bound to a boolean datatype

    Imported from legacy forums. Posted by Alan (had 423 views)

    User (Old forums)
    Member
    Post count: 23064

    Just to answer my own question if anyone else wants to center the Checkbox in a column.
    This is what i did.

    In the Resources section of the Grid
    <b>
    <grid:DataGridControl.Resources>
    <grid:CellEditor x:Key=”checkBoxTemplate”>
    <grid:CellEditor.EditTemplate>
    <DataTemplate>
    <CheckBox IsChecked=”{p:CellEditorBinding}” HorizontalAlignment=”Center”/>
    </DataTemplate>
    </grid:CellEditor.EditTemplate>
    <grid:CellEditor.ActivationGestures>
    <grid:KeyActivationGesture Key=”Space”/>
    </grid:CellEditor.ActivationGestures>
    </grid:CellEditor>
    </grid:DataGridControl.Resources>
    </b>

    Then on the column set the CellEditor property to this resource
    <b>
    <grid:Column CellEditor=”{StaticResource checkBoxTemplate}” />
    </b>

    Imported from legacy forums. Posted by Alan (had 4027 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.