Default style fore Null Value is grey check in XamCheckEditor. How can I change it to show null value as unchecked(false value)?
When XamCheckEditor value is True and IsReadOnly=True, it appears exactly the same way as Null Value(grey check), which is very confusing. How can I change it to Grey background with Black Check instead?
I use vs2010
I used Infragistics v11.2.20112.1012, and I see the following. I also have 10.3 and 11.1, should I uninstall? should not matter, right?
Hello,
I have been investigating into your issue and I do understand your concern. In order to achieve the desired behavior could re-template the xamCheckEditors default template, by placing the new modified ControlTemplate in a style. This style will be triggered when the Value property becomes Null. Since the default template is using a ValueEditorCheckBox, we can bind the IsChecked property of that control to the corresponding parents property including one important feature– we can put a value converter in order to catch the null value and return false. With that custom technique the controls Value property will remains Null, but the inner ValueEditorCheckBox would not be checked. That means the xamCheckEditor will never show the blue square that marks the Indeterminate state.
Here is a corresponding sample:
Xaml part
<local:TriggersConverter x:Key="someRes"/>
<Style TargetType="{x:Type igEditors:XamCheckEditor}">
<Style.Triggers>
<Trigger Property="Value" Value="{x:Null}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igEditors:XamCheckEditor}">
<Border x:Name="MainBorder"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<!-- SSP 10/3/07 BR25672 Added Padding="{TemplateBinding Padding}" to the ValueEditorCheckBox below -->
<igEditors:ValueEditorCheckBox x:Name="PART_FocusSite"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource kkk}, Path=IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsThreeState="{TemplateBinding IsThreeState}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
Code behind part:
public class TriggersConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
if (value == null)
return false;
}
return true;
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
return value;
In case of other concerns on that matter please do not hesitate to ask.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics Inc.
www.infragistics.com/support
This is what I see when paste your code in VS2010.
The second and third checkboxes are different - second is checked and third is null.
What is the version that you are using(it should looks like: 11.1.1002)
Just use the following example. You can see the second and third checkbox looks exactly the same. Although the second is really checked, and the third is null.
I want to show checkbox as unchecked when isChecked = null to make difference.
<Window x:Class="XamCheckEditor.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:igEditors="http://infragistics.com/Editors"> <Grid> <StackPanel> <igEditors:XamCheckEditor VerticalAlignment="Top" IsChecked="{x:Null}" /> <igEditors:XamCheckEditor VerticalAlignment="Top" IsReadOnly="True" IsChecked="True"/> <igEditors:XamCheckEditor VerticalAlignment="Top" IsReadOnly="True" IsChecked="{x:Null}"/> </StackPanel> </Grid></Window>