XML
  Home arrow XML arrow Page 4 - XAML in a Nutshell
Moblin
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

XAML in a Nutshell
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2007-03-29

    Table of Contents:
  • XAML in a Nutshell
  • Basic Rules for XAML Elements
  • Elements
  • Control Elements

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    XAML in a Nutshell - Control Elements


    (Page 4 of 4 )

    Control elements handle user interaction. Controls are interactive and allow the user to enter data, make choices, and perform other interactive tasks. They can be broken up into five categories: simple controls, content controls, item controls, header item controls, and header content controls. They are differentiated by the attributes they support, namely Content, Headers , and Items . Attribute support is determined by the underlying CLR class represented by the XAML element. Even if you don’t use the Header attribute supported by a header item control, it doesn’t become an item control because the CLR class it represents still has a Header whether or not you assign it a value. Table 3-1 summarizes this information neatly.

    Simple controls

    Derive directly from the System.Windows.Control class and do not have Content , Items , or Header attributes. Examples of simple controls are HorizontalScrollBar , VerticalScrollBar , Frame , TextBox , and RichTextBox .

    Content controls

    Have a Content attribute, but no Items or Header attributes. Content controls are restricted to only one element as its content, though that content may be an element (such as a Panel ) that can contain more than one element. Examples of content controls are Button , RepeatButton , Label , RadioButton , CheckBox , ListBoxItem , GroupItem , StatusBarItem , ToolTip , ScrollViewer , and Window .

    Item controls

    Have an Items attribute, but no Header or Content attributes. Item controls expose a list of elements, usually offering you a choice. Item controls include ListBox , ComboBox , Menu , ContextMenu , RadioButtonList , and TabControl .

    Header item controls

    Have an Items attribute and a Header attribute but no Content attribute. The Header attribute determines the label for the Items , and the Items attribute contains child elements. The Items attribute is implicitly declared as a sequence of child elements that are not assigned to it. The following declaration of a MenuItem shows how this works:

      <MenuItem Header="First Menu Item">
           
    <MenuItem Header="First Child Item" />
           
    <MenuItem Header="Second Child Item" />
     
    </MenuItem>

    Header item controls include MenuItem and ToolBar .

    Header content controls

    Have a Header attribute and a Content attribute, but no Items attribute. Like a content control, the header content control may contain only one child element in its Content attribute. Header content controls include Expander and TabItem .

    Table 3-1. Attributes supported by control type

    Content Header Items
    Simple N N N
    Content Y N N
    Item N N Y
    Header item N Y Y
    Header content Y Y N

    Please check back next week for the continuation of this article.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This article is an excerpt from the book "The Basics of XAML," published by...
     

    Buy this book now. This article is excerpted from chapter 3 of The Basics of XAML, written by Lori A. MacVittie (O'Reilly, 2006; ISBN: 0596526733). Check it out today at your favorite bookstore. Buy this book now.

    XML ARTICLES

    - More on Triggers and Styles and Control Temp...
    - Looking at Triggers with Styles and Control ...
    - A Closer Look at Styles and Control Templates
    - Styles and Control Templates
    - Properties and More in XAML
    - Elements and Attributes in XAML
    - XAML in a Nutshell
    - Importing XML Files into Access 2007
    - Using MSXML3.0 with VB 6.0
    - MSXML, concluded
    - MSXML, continued
    - MSXML Tutorial
    - Generating XML Schema Dynamically Using VB.N...
    - XSL Transformations using ASP.NET
    - Applying XSLT to XML Using ASP.NET





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway