All,
I have a scenario where I need to change the background of a record under certain conditions. If I do this by defining a style for the DataRecordCellArea then I lose all of the existing style elements.
All our XamDataGrid's are themed with Theme="[current]" so that theme switches by the user apply consistently across all grids.
Applying this style with, or without a key but not basing it on anything in this specific grid reverts back to a default style for items such as hover and selection colors, as expected.
Is there any way that I can, for this grid, define the a background color in the DataRecordCellArea, yet set BasedOn to the current theme's style for DataRecordCellArea?
Hello Mark,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
I'm sorry - I'm not convinced that building the styles using string concatenation and applying them into the XAML is the correct way to approach this, and certainly not something I'd expect you to be recommending to your customers.
I will stick with my theme based resource locator that I can use with XAML static bindings instead.
Thanks for looking into whether there was an alternative solution though.
I have been looking into your requirement and I can say that for every theme there should be a Style based on it. I created a sample project for you that shows how to use one Style and just change the name of the Theme that is currently selected. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
I read that post while investigating a solution, but it only covers the case where you have chosen a predefined style and are using that through the entire app.
I couldn't find anything that covers using the ThemeManager, ie, being able to exend the users currently selected theme, so that you can BasedOn the Currently Selected Theme, that is, one that's not known at design time.
That post covers building the name of the resource in the dictionary based on theme, essentially you'd have to be able to do something like DataPresenterCurrentSelectedTheme.CellViewPresenterStyle
Thank you for your post. I have been looking into it and I suggest you see this blog:
http://blogs.infragistics.com/blogs/andrew_smith/archive/2009/12/09/common-style-issues-when-using-the-theme-property.aspx
where it is described how to use both Themes and Styles.
Hope this helps you.