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
xamCheckEditor - IsReadOnly - Change Background
posted

Hi there

I'm trying to change the background of a XamCheckEditor, which is used in a XamDataGrid, to show boolean values.

I created a Style with a key, and one without, so  the Style gets applied to all XamCheckEditors and can be used to inherit from with the attribute 'BasedOn'. This works. But...

It kills the look, which comes from the theme (i think).

Here is the Style, which gets loaded in a resource dictionary:

    <!-- igEditors:XamCheckEditor -->
    <!--keyed base style, and not keyed, based on keyed-->
    <Style TargetType="{x:Type igEditors:XamCheckEditor}" x:Key="baseXamCheckEditorStyle" >
        <Setter Property="Height" Value="23"/>
        <Style.Triggers>
            <Trigger Property="IsReadOnly" Value="{StaticResource BooleanTrue}">
                <!--<Setter Property="BorderBrush" Value="{DynamicResource readOnlyBorderBrush}"/>-->
                <Setter Property="Background" Value="{DynamicResource readOnlyBackgroundBrush}"/>
                <Setter Property="Foreground" Value="{DynamicResource readOnlyBackgroundBrush}"/>
            </Trigger>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource notValidBorderBrush}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    <!--Not keyed base style, so it's getting applied to all controls, and can be based on with the same properties and triggers-->
    <Style TargetType="{x:Type igEditors:XamCheckEditor}" BasedOn="{StaticResource baseXamCheckEditorStyle}" />


Then the XamCheckEditor looses its flat look, and the yellow background, gets shown a little bit:

(Top one, is IsReadOnly)

What i try to achieve, is that the yellow background gets applied to the whole cell, and or to the whole XamCheckEditor. And keep the flat look:

But with the yellow background, when it is IsReadOnly = true.

I'm stuck, tried a lot of things. But none of them was working, the way i expected. Can you help me?
I use the same approeach on a lot of other Infragsitic controls like XamComboEditor, XamDateTimeEditor, and on all of them, it works like expected.

Parents
No Data
Reply
  • 34810
    Offline posted

    Hello Andreas,

    It appears that you are losing what appears to be the Office2013 style because your “baseXamCheckEditorStyle” is not currently basing on the Office2013 theme for the XamCheckEditor. In order to do this, I would recommend using the following Style definition, where “igThemes” points at xmlns:igThemes="http://infragistics.com/Themes"

    <Style TargetType="{x:Type igEditors:XamCheckEditor}" x:Key="baseXamCheckEditorStyle" BasedOn="{x:Static igThemes:EditorsOffice2013.XamCheckEditor}" >

    This should retain the Office2013 theme style for the XamCheckEditor while still applying your colors when the control is read-only.

    Please let me know if you have any other questions or concerns on this matter.

Children
No Data