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
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
Hallo Valerie,
Sorry for the late replay. I just tried the sample application and got a hand full of errors in the styles. I tried making all the changes you made, but without any success.
Can you please look once more to this issue?
Thanks, Jan
What type of errors are you getting running the sample?
Hello Valerie,
Copy past out of VS:Error The attachable property 'RecognizesAccessKey' was not found in type 'XamlHelper'. WpfApplication1 ...\WpfApplication1\WpfApplication1\OfficeTheme\Styles.Shared.xaml 573 Error The attachable property 'RecognizesAccessKey' was not found in type 'XamlHelper'. WpfApplication1 ...\WpfApplication1\WpfApplication1\OfficeTheme\Styles.Shared.xaml 664 Error The member "RecognizesAccessKey" is not recognized or is not accessible. WpfApplication1 ...\WpfApplication1\WpfApplication1\OfficeTheme\Styles.Shared.xaml 573 Error The member "RecognizesAccessKey" is not recognized or is not accessible. WpfApplication1 ...\WpfApplication1\WpfApplication1\OfficeTheme\Styles.Shared.xaml 664 Error The property 'XamlHelper.RecognizesAccessKey' does not exist in XML namespace 'http://schemas.infragistics.com/xaml/primitives'. Line 573 Position 196. WpfApplication1 ...\WpfApplication1\WpfApplication1\OfficeTheme\Styles.Shared.xaml 573
Originally when I created the sample I was using the latest service release for 15.2. If you upgrade to the latest service release this should resolve the problem with finding XamlHelper.RecognizesAccessKey. Otherwise you can just remove igPrim:XamlHelper.RecognizesAccessKey="True" from the xaml in the Styles.Shared.xaml file.
Please let me know if you have any questions,
Sincerely,
the last Service release did the Job.