UserControl
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Control
System.Windows.Controls.ContentControl
System.Windows.Controls.UserControlThe UserControl class is
designed to provide an easy way to build a custom control using the same
techniques and tools you would use to create a window: the appearance is
defined with markup, and the behavior is defined in a code-behind file.
This provides an easy way to build a reusable chunk of user interface.
It also offers a useful tool for managing complexity: if a window has
become too complex, it may be easier to split its content into a set of
user controls, allowing developers to work on individual pieces
independently.
UserControl is almost identical
to its base class, ContentControl. It
adjusts the default values for a few properties. For example, a UserControl disables keyboard focus and tab
stop navigation for itself, although not for its content—the assumption
is that a UserControl will typically
contain focus targets such as text boxes and buttons, so the containing
control itself will usually not need to act as a distinct focus
target.
UserControl is not strictly
necessary for building elements through markup, composition, and code
behind. You can also use this style if you derive directly from ContentControl, or any other element that
accepts one or more children, such as Decorator ...