This section provides a visual and descriptive overview of the elements that comprise the C1Window control. Like a typical dialog box, the C1Window control includes two main elements: a header and a content area:
The header area includes the typical caption bar elements including title text and Minimize, Maximize, and Close buttons:
You can set the text in the header with the Header property. You can set the visibility of the buttons using the ShowCloseButton, ShowMaximizeButton, and ShowMinimizeButton properties. By default all three properties are True and the buttons are visible. You can also set the Header property to a UIElement, which would allow you to add an icon next to the text in the caption bar.
Setting HeaderText
You can set the Header text in XAML markup, in code, or at design time.
To set the Header text, use the following markup:
XAML Copy Code <c1:C1Window Height="110" Width="220" Content="C1Window" Header="Hello World!"/>
Use the following code to set the Header property:
Visual Basic Copy CodeMe.C1Window1.Header = "Hello World!"
C# Copy Code this.c1window1.Header = "Hello World!";
To set the Header property at design time, complete the following steps:
Click the C1Window control once to select it. Navigate to the Properties window and locate the Header item. Click in the text box next to the Header item, and enter "Hello World!" or some other text.This will set the Header property and the text in the caption bar of the dialog window to the text you chose.
Hiding Header Buttons
By default the window displays Minimize, Maximize, and Close buttons, but you can customize this at design time, in XAML, and in code.
Use markup similar to the following to set the visibility for the header buttons:
XAML Copy Code <c1:C1Window Height="129" Width="220" Content="C1Window" ShowMaximizeButton="False" ShowMinimizeButton="False"/>
Use code similar to the following to set the visibility for the header buttons:
Visual Basic Copy Code Me.C1Window1.ShowMaximizeButton = False Me.C1Window1.ShowMinimizeButton = False
C# Copy Code this.c1window1.ShowMaximizeButton = false; this.c1window1.ShowMinimizeButton = false;
To hide the Maximize and Minimize buttons, complete the following steps:
- Click the C1Window control once to select it.
- Navigate to the Properties window.
- Locate the ShowMaximizeButton item and clear the check box next to the item.
- Locate the ShowMinimizeButton item and clear the check box next to the item.
The content area of the C1Window control can be set using the Content property. The content area can contain controls, a panel (such as a Grid or StackPanel) that contains controls, text, or other elements. You can, for example, set the Content property to a UserControl that contains many controls and elements.
Setting the Content property is simple using XAML markup:
XAML |
Copy Code
|
---|---|
<c1:C1Window Height="129" Width="220" Content="The project was successfully updated."/> |