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
1540
Applying a keyed TextBlock resource to multiple UnboundField
posted

I have a XamDataGrid bound to data that consists of a DateTime field and some string fields using UnboundField elements in the XAML.  The DateTime field specifies EditAsType as DateTime so that I can modify the XamDateTimeEditor.Mask property in the EditorStyle.

However, I have a keyed resource with a TargetType of TextBlock that I wish to apply to all of my fields.  I know that the underlying control for XamDateTimeEditor and the auto-generated XamTextEditor controls for my string fields is a TextBlock.

The mocked-up XAML and C# code for this situation is in the attachment.  How do I apply the keyed resource to all of the fields without messing up the XamDateTimeEditor and without repeating XAML code for each UnboundField?  Also, my restrictions are: the resource cannot change; and the fields must remain UnboundFields.

Thanks.

Sandbox.zip