简体   繁体   中英

Create custom user controls in wpf for reuse

I was wondering how could I save a user control just like we can save ac# class in a dll file and import that file whenever we need to use that class. How could we import that control and use it. It will be nice if we could make custom controls and save them for reuse instead of having to copy the xaml and code behind every time we had to use it.

You have exactly that flexibility with WPF and a lot of choices. Here is an excellent introduction to your options:

These choices include:

  • Deriving from UserControl
  • Deriving from Control
  • Deriving from FrameworkElement

The tradeoffs are described in detail in the article.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM