作为程序员一般都比较害怕搞界面,这下硬着头皮上,折腾折腾Blend,抄抄改改各种style,弄着弄着居然能看懂个大概了。最后在自己建立的UI库项目中如何组织资源有了一些总结,进入正题:
“Generic.xaml” 早有耳闻,不清楚究竟有什么作用。这次Google之,stackoverflow上早已有人发问。What is so special about Generic.xaml?
第一个答案清晰明了。
Every Control in WPF has a default Style that provides, among other things, the Control's default
ControlTemplate
. WPF looks for the default style in a special resource dictionary in the Themes folder in the same assembly as the control. The key for the default style is provided by theControl.DefaultStyleKey
dependency property, the default value of which is overridden in each sub-class of Control.The name of the resource dictionary depends on the cu