Disable background color 'dim' for readonly

4 posts, 0 answers
  1. Chad
    Chad avatar
    23 posts
    Member since:
    Aug 2013

    Posted 13 Jan Link to this post

    An input control will 'dim' it's background color when IsReadOnly is set to true. This, unfortunately, have the undesired side effect of turning some lighter colors gray. Is there a means of setting the 'read-only' background color without it being altered by the control when the control is read only?
  2. Dinko
    Admin
    Dinko avatar
    257 posts

    Posted 17 Jan Link to this post

    Hello Chad,

    If we have understood you correctly, you want to change the background color of the mask when the IsReadOnly property is set to true. If this is the case, you can extract and edit the default template of the control. In the extracted template, you can navigate to a VisualState with x:Name="ReadOnly" and set your custom color. If we are in the wrong direction you can elaborate more on what exactly you are trying to achieve in your application. You can send us pictures with the desired result. This way we can better understand your approach.

    Regards,
    Dinko
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Chad
    Chad avatar
    23 posts
    Member since:
    Aug 2013

    Posted 18 Jan in reply to Dinko Link to this post

    Hi & thanks Dinko,

    That's it, now I just wish there was a global/theme way of altering that brush color for all the controls at once.

    Regards,
    Chad

  4. Dinko
    Admin
    Dinko avatar
    257 posts

    Posted 23 Jan Link to this post

    Hi Chad,

    Currently, only the Office2016 and Green themes provide a property which you can use to change the global ReadOnly background color for all controls.
    public MainWindow()
    {
        InitializeComponent();
        Office2016Palette.Palette.ReadOnlyBackgroundColor = Color.FromRgb(255,0,0);
            // or
        GreenPalette.Palette.ReadOnlyBackgroundColor = Color.FromRgb(255, 0, 0);
    }

    Regards,
    Dinko
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top