When I override the default style/controltemplate of a standard WPF control in blend using "Edit a Copy" without modifying it (just creating a local copy of if), will this 开发者_如何学编程already break theming in some scenarios? In other words, do different themes provide differnt controltemplate- and/or styledefinitions for the standard controls? How can I make sure that my styles/controltemplates respect theming?
Yes, this breaks theming;
Yes, different themes provide different controls styles. If you have MS Blend you can find them in Blend's folder (e.g. in C:\Program Files\Microsoft Expression\Blend 3\SystemThemes\Wpf )
To respect theming, you should also create one style per theme for your control. There are many resources out there on custom control and themes support. Just to mention one: WPF: Changing control style based on the system theme
As a developer you want to author your controls in terms of their functionality. Use default control styles everywhere. Then let the pro's handle the graphic design aspect of it. If you override a control's ControlTemplate you are busy with theming already.
If you do muck around with ControlTemplates try and keep with the standard approach, otherwise once the graphic designer starts working on the application he/she's going to swear at you :)
Themes are collections of styles that target individual controls and redefine their look-and-feel. Any Control for which you've provided a ControlTemplate will either not have it applied or won't be consistent with the theme-pack (depending on whether you access the theme by x:Name or by Type)
If you override DataTemplates, you are fine however. This you can safely do without worrying about theming interference.
精彩评论