XML
  Home arrow XML arrow Page 2 - Elements and Attributes in XAML
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 
VeriSign Whitepapers 
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

Elements and Attributes in XAML
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2007-04-05

    Table of Contents:
  • Elements and Attributes in XAML
  • Document Elements
  • Attributes
  • Assigning XAML Attributes

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Elements and Attributes in XAML - Document Elements


    (Page 2 of 4 )

    Document elements handle document presentation. Documents are categorized as either flow or fixed. The FixedDocument element is designed to be What You See Is What You Get (WYSIWYG) and is intended to appear in all formats (print, browser, application) with exactly the same layout.

    A FlowDocument element provides more flexibility in appearance to enhance readability. Flow documents dynamically reformat content based on a variety of factors, including screen and page size, font size, and optional user preferences. Flow documents are comprised of one or more elements derived from Block or Inline . Block elements such as Block , Figure , Floater , List , ListItem , Paragraph , Section , Table , and TableCell are used to organize and format blocks of text. Inline elements are used to format text within a block. Inline elements are Bold , AccessKey , LineBreak , Hyperlink , Italic , Subscript , Superscript , and Underline .

    Some of these elements might look familiar, such as Paragraph , Table , and Italic . Similar formatting elements exist in other user-interface markup languages, such as <p> , <table> , and <i> , respectively, in HTML. These elements are virtually identical in execution but have structural differences as well as an abundance of attributes in XAML that do not exist in their HTML counterparts.

    While the core syntax of XAML is very similar to markup languages such as HTML, XAML user-interface elements are not restricted to containing traditional content. For example, a Button is not required, nor restricted, to present text-based content as a prompt. The flexibility of XAML and its object-oriented nature offer unlimited possibilities. You can just as easily decorate the face of a Button with any UIElement -derived element. Example 3-6 declares three circles—defined by an Ellipse element with equivalent x- and y-axis radii—as the content element of a Button . While content control-derived classes may only have one child element, that child element may contain additional elements, such as the DockPanel or StackPanel .

    Example 3-6. Using alternate elements as the content of a Button

    <StackPanel xmlns=http://schemas.microsoft.com/winfx/ avalon/2005
        HorizontalAlignment="Center"
        Margin="10">
        <Button
           
    Width="50 "
            Height="100">
            <DockPanel>
               
    <Ellipse Margin="5"
                     DockPanel.Dock="Top"
                     Stroke="Black"
                     RadiusX="10"
                     RadiusY="10"
                     Fill="Red" />
               
    <Ellipse Margin="5"
                     DockPanel.Dock="Top"
                     Stroke="Black"
                     RadiusX="10"
                     RadiusY="10"

                     Fill="Yellow" />
               
    <Ellipse Margin="5"
                     DockPanel.Dock="Top"
                     Stroke="Black"
                     RadiusX="10"
                     RadiusY="10"
                     Fill="Green" />
          
    </DockPanel>
        </Button>
    </StackPanel>

    The result of evaluating Example 3-6 is shown in Figure 3-2.


    Figure 3-2.  Defining a content control with multiple child elements

    More XML Articles
    More By O'Reilly Media


       · 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 2 hosted by Hostway