Examples of types of content for controls in UWP

Content of Controls follow this inheritance order:

DependencyObject
     --->UIElement
       --->FrameworkElement
         --->Control
          ---->ContentControl

Content property of a ContentControl can any of:
string
UIElement
DateTime


Controls such as BUTTON, CHECKBOX and SCROLLVIEWER inherits directly or indirectly from the CotentControl Class

When UIElement is set as Content property then the UI is displayed in the ContentControl.

When Content property is string or DateTime, a string representation of the object is displayed in the Control.

Here is a object whose Content is a string. The BUTTON's content is a string.


ContentString.png

Here are UIElements that are the Content of a Control

 A Rectangle object is the content of a Button.

ContentUI_0

A TEXTBOX is the content of this BUTTON



ContentUI_1



A BUTTON can also be the content of a BUTTON.

ContentUI_2

The content of this CHECKBOX are multiple UI Elements inside a StackPanel
 
ContentUI_3

Here is DateTime object as Content of a Control (note:date is today's date by default)
 


Comments

Popular posts from this blog

Towards cross-platform development..

Event Code: UI design with XAML in Visual Studio 2017 - 2

Deploying a Universal Windows Project to Lumia 950