I have a requirement to change a very small part of the WPF ComboBox's template.
If I take a copy of the existing template for the Luna theme and make the change it all works fine initially. But if the user has a different theme, my ComboBox
retains it's custom theme, (Which is obviously based on Luna) so looks out of place.
Is there any way of overriding just parts of a template so the majority of the template still respects the windows theme?
I notice that parts of the template define an mwt namespace with an explicit reference to Luna:
xmlns:mwt="...blah blah...=PresentationFramework.Luna"
perhaps there is some way to have this mwt namespace refer to the current theme rather than specifically the Luna one?
Or do I have to provide a custom copy of the template for each theme? And what happens if MS creates a new theme, will I then have to update my template to support it?
(The bit I am changing just relates to the TextBlock
displayed when the combo box is closed. I'm not changing the dropdown or the button. Ideally I would just override the SelectionBoxItemTemplate
on the ComboBox
, but this is readonly, so as far as I can tell I have to override the whole control template to make any changes.)
[Related question, but no answers: Adjust a Control Template and still respect the Theme of the OS?]