Basic Library for WPF and Silverlight | ComponentOne
WPF and Silverlight Edition Basic Library / Windows / Windows Elements
In This Topic
    Windows Elements
    In This Topic

    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 ShowCloseButtonShowMaximizeButton, 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.

    • In XAML

    To set the Header text, use the following markup:

    XAML
    Copy Code
    <c1:C1Window Height="110" Width="220" Content="C1Window" Header="Hello World!"/>
    
    • In Code

    Use the following code to set the Header property:

    Visual Basic
    Copy Code
    Me.C1Window1.Header = "Hello World!"
    

     

    C#
    Copy Code
    this.c1window1.Header = "Hello World!";
    
    • At Design Time

    To set the Header property at design time, complete the following steps:

    1. Click the C1Window control once to select it.
    2. Navigate to the Properties window and locate the Header item.
    3. 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.

    • In XAML

    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"/>
    
    • In Code

    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;
    
    • At Design Time

    To hide the Maximize and Minimize buttons, complete the following steps:

    1. Click the C1Window control once to select it.
    2. Navigate to the Properties window.
    3. Locate the ShowMaximizeButton item and clear the check box next to the item.
    4. 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."/>