문제

I was reading WPF toolkit's source code, and I found in the Toolkit project, every control was written in two folders named :Implementation and Themes.

Like this: - WatermarkTextBox -- Implementation WatermarkTextBox.cs -- Themes Generic.xaml

By doing this, the control can apply to the Theme by default. By when I delete the Generic.xaml, the Visual Studio get en error to find the Generic.xaml file.

So, I'm confused about this pattern, is this a pattern supported by Visual Studio?

도움이 되었습니까?

해결책

If you create a CustomControl in WPF, you should put your default Style into a file named Generic.xaml. The Framework looks into this file to find default Styles for all CustomControl objects and will give you that error if the file is missing.

You can find a fuller description from the 'Define and Use Shared Resources' section of the Control Authoring Overview page at MSDN.

You can find more exact help with creating a CustomControl from the Try it: Create a custom WPF control page at MSDN.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top