Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Applying cell selection style for an unboundfield with a checkbox in it
posted

My xamdatagrid has seperate styles for row selection and cell selection.

When a checkbox is placed inside the unbound field of xamdatagrid,

1)     the default row selection style is applied to the entire row along with the cells containing the checkbox (viz. can see the style --> color in the cell area which surrounds the checkbox) --> working fine!

2)     but cell selection style could'nt be applyed (viz. when i click on the cell which contains the checkbox, i cannot see the style --> color change for that particular cell as in other unbound fields which do not contain the control template) --> not working

 The code is,

<igDP:UnboundField Width="50"

                   Height="25"                                                     

                   Binding="{Binding Enablebelow,Mode=TwoWay}" >

                        <igDP:UnboundField.Settings>

                            <igDP:FieldSettings CellClickAction="SelectCell" >

                                <igDP:FieldSettings.CellValuePresenterStyle>

                                    <Style TargetType="{x:Type igDP:CellValuePresenter }">

                                        <Setter Property="Template">

                                            <Setter.Value>

                                                <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">

                                                    <Grid height=”15”

                                                             Width = “15”>

                                                        <igEdit:XamCheckEditor MouseLeftButtonDown="XamCheckEditor_MouseLeftButtonDown" IsChecked="{Binding Path=DataItem.Enablebelow,Mode=TwoWay}" />

                                                    </Grid>

                                                </ControlTemplate>

                                            </Setter.Value>

                                        </Setter>

                                    </Style>

                                </igDP:FieldSettings.CellValuePresenterStyle>                               

                            </igDP:FieldSettings>                          

                        </igDP:UnboundField.Settings>                      

                    </igDP:UnboundField>

Parents
No Data
Reply
  • 138253
    Verified Answer
    Offline posted

    Hello Gowsikhaa,

     

    Thank you for your post. I have been looking into it and I can suggest you set the CellValuePresenter’s ContentTemplate instead of its Tempalte, so you could be able to use the default functionality. You can modify your Style like this:

    <Style TargetType="{x:Type igDP:CellValuePresenter }">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid height="15" Width = "15">
                        <igEdit:XamCheckEditor MouseLeftButtonDown="XamCheckEditor_MouseLeftButtonDown" IsChecked="{Binding Path=DataItem.Enablebelow,Mode=TwoWay}" />
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

     

    Please let me know if this helps you or you need further assistance on this matter.

    Looking forward for your reply.

Children