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
355
RecordSelector IsAlternate
posted

I have my datagrid set up with checkboxes as the RowSelector as per the Feature Browser example.  I'm looking for a way to find out if the RowSelector is part of an alternate row so I can have it styled with the same background color as my alternate row  style for DataRecordCellArea.  For example, I need to do something like this...

 

<Style TargetType="{x:Type igDP:RecordSelector}" BasedOn="{x:Null}">

                            <Setter Property="BorderBrush" Value="#DFDFDF"/>

                            <Setter Property="BorderThickness" Value="0,0,0,1"/>

                            <Setter Property="Template">

                                <Setter.Value>

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

                                        <Grid>

                                            <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/>

                                            <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding Path=DataItem.IsSelected, Mode=TwoWay}"/>

                                        </Grid>

 

                                        <ControlTemplate.Triggers>

                                            <DataTrigger Binding="{Binding Path=IsAlternate, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={ x:Type igDP:DataRecordCellArea}} }" Value="True">

                                                <Setter Property="Background" Value="Red" />

                                            </DataTrigger>

                                        </ControlTemplate.Triggers>

                                    </ControlTemplate>

                                </Setter.Value>

                            </Setter>

                        </Style>

Obviously this doesn't work because the RowSelector isn't a child of the DataRecordCellArea.  Any help would be appreciated, thanks.

 

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I suggest you use the following Style instead of yours:

     

    <Style TargetType="{x:Type igDP:RecordSelector}" BasedOn="{x:Null}">
        <Setter Property="BorderBrush" Value="#DFDFDF"/>
        <Setter Property="BorderThickness" Value="0,0,0,1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type igDP:RecordSelector}">                           
                    <Grid x:Name="grid" >
                        <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/>
                        <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding Path=DataItem.IsSelected, Mode=TwoWay}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=IsAlternate, RelativeSource={RelativeSource AncestorType={ x:Type igDP:DataRecordPresenter}} }" Value="True">
                            <Setter TargetName="grid" Property="Background" Value="Red" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </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