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
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
Hi Valerie
I tested this solution with the code behind.. and it does not work the way i want. With this solution, the image is not shown in the filter record.. but the complete cell is not visible.. this means, that the filter cells are moved to the left, so they're not aligned with the data-cells anymore. Also the functionality to clear all filter is not available!
Regards
Thank you for your input. But is there no way to do the same, without using any code behind?