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
1470
Custom RecordSelector
posted

Hi there

i tried to create a custom RecordSelector following a sample in the Sample Browser. I followed the sample 'xamDataGrid' --> 'Display' --> 'CheckBox in Record Selectors'.

I display an icon there, when the underlying dataItem.SomeProperty == true (with the Infragistics.Controls.Primitives.BoolToVisibilityConverter). This works fine, but the icon (or the ControlTemplate) is also displayed on the filter row (Filter Record). And is always showed there.

How can i disabled it? I tried to trigger it with a Trigger which is checking the IsDataRecord property, but this does not work. Also i want to keep the functionality, when the user clicks there to clear all the filters.

Can you give me some advise? :)

Kind regards

Parents
No Data
Reply
  • 14517
    Offline posted

    Hello Andreas,

    You can add a relative source binding to the DataRecordPresenter’s RecordType on the visibility of the RecordSelector and set the vibility based on the type of row it is displayed in:

    <local:VisibilityConverter x:Key="VisibilityConverter"/>

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

                <Setter Property="Template">

                    <Setter.Value>

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

                            <CheckBox HorizontalAlignment="Center"

                                              VerticalAlignment="Center"

                                              IsChecked="{Binding Path=DataItem.IsChecked, Mode=TwoWay}" />

                        </ControlTemplate>

                    </Setter.Value>

                </Setter>

                <Setter Property="Visibility" Value="{Binding DataContext.RecordType, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordPresenter}},  Converter={StaticResource VisibilityConverter}}"/>

    </Style>

      

    public class VisibilityConverter : IValueConverter

        {

            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

            {

                if (value is RecordType)

                {

                    RecordType rt = (RecordType) value;

                    if (rt == RecordType.FilterRecord)

                        return Visibility.Collapsed;

                    else

                     return Visibility.Visible;

                }

                return Binding.DoNothing;

               

            }

     

            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

            {

                throw new NotImplementedException();

            }

        }

     

    Please let me know if you have any questions.

     

    Sincerely,

    Valerie

    Software Developer

    Infragistics Inc

Children