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
270
Readonly Style
posted

Hello guys,

I’m using a XamPropertyGrid (Version:2015.2, Style:Office2013, .Net:4.6.1, Win10 Desktop) in a readonly mode to display some data.

In the readonly mode the Timepicker (#FF000000) has a different color than the Textboxes (#FF808080).

We would like to change the style so that we have only one kind of grey. Where do I need to change the Styles?

 

I have one more question: We want only grey when the property is readonly and not for the whole control, but when the whole control is readonly then we want the property black. How and where can I do this?

Thanks for the help,

Jan

Parents
  • 14517
    Verified Answer
    Offline posted

    Hello Jan,

    The property grid uses the XamDateTimeInput to display date fields. Currently the XamDateTimeInput is configured to set change the opacity of the embedded MaskedInputTextBox when the control is disabled (i.e ReadOnly). You can find the default styles used for the XamDateTimeinput in C:\Program Files (x86)\Infragistics\2015.2\WPF\DefaultStyles\DateTimeInput\generic.shared.xaml or if you are using the office 2013 theme the styles can be found in C:\Program Files (x86)\Infragistics\2015.2\WPF\Themes\Office2013\Office2013.xamDateTimeInput.xaml. To change the gray color you would need to include the appropriate default style in your application and modify the style so that the control changes the Foreground color of the PART_InputTextBox as opposed to the Opacity for the Disabled visual state. In addition, you would also need to include the style file for the XamPropertyGrid itself since this currently sets a style for the XamDateTimeInput within the PropertyGridItemLayoutPanel’s Resources, which would need to be removed to pick up your new modified style. The styles for the XamPropertyGrid can be also found either under the directory for the control in the DefaultStyles folder or in the Office2013.xamPivotGrid.xaml file under the Office2013 theme. Finally since we are removing the style set in the XamPropertyGrid’s implicit style you may want to move those settings to the XamDateTimeInput’s style. I have attached a simple sample illustrating this, you can find the changes to the XAML style files by looking for the comments labeled with “IG DS”.

    If you wish to change the text color when the whole control is read only this may require significantly more effort as the controls are currently using the Visual State to set the “read only” look. Instead you would need to change the styles for all of the embedded controls, both Infragistics and MS textbox to create a style which looks at both the enabled property of the control as well as whatever indictor you are using to determine that the control is read only and set the properties accordingly (one possible implementation could be to use a multi-converter). Changing all of the styles can be accomplished similarly to above by getting the current styles from the directories I mentioned above and including the modified styles in the project.  You can find the styles for the MS controls for the Office2013 theme in the file Office2013.MSControls.Core.Implicit.xaml.

    Please let me know if you have any questions.

    Sincerely

    Valerie

    Software Developer

    Infragistics Inc

    WpfApplication1.zip
Reply Children