Sunday 25 January 2015

What is XAML

What is XAML?


XAML is a declarative markup language. As applied to the .NET Framework programming model, XAML simplifies creating a UI for a .NET Framework application. You can create visible UI elements in the declarative XAML markup, and then separate the UI definition from the run-time logic by using code-behind files, joined to the markup through partial class definitions. XAML directly represents the instantiation of objects in a specific set of backing types defined in assemblies. This is unlike most other markup languages, which are typically an interpreted language without such a direct tie to a backing type system. XAML enables a workflow where separate parties can work on the UI and the logic of an application, using potentially different tools.
When represented as text, XAML files are XML files that generally have the .xaml extension. The files can be encoded by any XML encoding, but encoding as UTF-8 is typical.

XAML Syntax in Brief

The following sections explain the basic forms of XAML syntax, and give a short markup example. These sections are not intended to provide complete information about each syntax form, such as how these are represented in the backing type system. For more information about the specifics of XAML syntax for each of the syntax forms introduced in this topic, see XAML Syntax In Detail.
Much of the material in the next few sections will be elementary to you, if you have previous familiarity with the XML language. This is a consequence of one of the basic design principles of XAML. XAML The XAML language defines concepts of its own, but these concepts work within the XML language and markup form.

XAML Object Elements

An object element typically declares an instance of a type. That type is defined in the assemblies that provide the backing types for a technology that uses XAML as a language.
Object element syntax always starts with an opening angle bracket (<). This is followed by the name of the type where you want to create an instance. (The name can possibly include a prefix, a concept that will be explained later.) After this, you can optionally declare attributes on the object element. To complete the object element tag, end with a closing angle bracket (>). You can instead use a self-closing form that does not have any content, by completing the tag with a forward slash and closing angle bracket in succession (/>). For example, look at the previously shown markup snippet again:
<StackPanel>
<Button Content="Click Me"/>
</StackPanel>
This specifies two object elements: <StackPanel> (with content, and a closing tag later), and <Button .../> (the self-closing form, with several attributes). The object elements StackPanel and Button each map to the name of a class that is defined by WPF and is part of the WPF assemblies. When you specify an object element tag, you create an instruction for XAML processing to create a new instance. Each instance is created by calling the default constructor of the underlying type when parsing and loading the XAML.

Attribute Syntax (Properties)

Properties of an object can often be expressed as attributes of the object element. An attribute syntax names the property that is being set in attribute syntax, followed by the assignment operator (=). The value of an attribute is always specified as a string that is contained within quotation marks.
Attribute syntax is the most streamlined property setting syntax and is the most intuitive syntax to use for developers who have used markup languages in the past. For example, the following markup creates a button that has red text and a blue background in addition to display text specified as Content.
<Button Background="Blue" Foreground="Red" Content="This is a button"/>

Property Element Syntax

For some properties of an object element, attribute syntax is not possible, because the object or information necessary to provide the property value cannot be adequately expressed within the quotation mark and string restrictions of attribute syntax. For these cases, a different syntax known as property element syntax can be used.
The syntax for the property element start tag is <typeName.propertyName>. Generally, the content of that tag is an object element of the type that the property takes as its value . After specifying content, you must close the property element with an end tag. The syntax for the end tag is </typeName.propertyName>.
If an attribute syntax is possible, using the attribute syntax is typically more convenient and enables a more compact markup, but that is often just a matter of style, not a technical limitation. The following example shows the same properties being set as in the previous attribute syntax example, but this time by using property element syntax for all properties of the Button.
<Button>
<Button.Background>
<SolidColorBrush Color="Blue"/>
</Button.Background>
<Button.Foreground>
<SolidColorBrush Color="Red"/>
</Button.Foreground>
<Button.Content>
This is a button
</Button.Content>
</Button>
The XAML language includes some optimizations that produce more human-readable markup. One such optimization is that if a particular property takes a collection type, then items that you declare in markup as child elements within that property's value become part of the collection. In this case a collection of child object elements is the value being set to the collection property.
The following example shows collection syntax for setting values of the GradientStops property:
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<!-- no explicit new GradientStopCollection, parser knows how to find or create -->
<GradientStop Offset="0.0" Color="Red" />
<GradientStop Offset="1.0" Color="Blue" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>










Content Properties and Collection Syntax Combined

Consider this example:
<StackPanel>
<Button>First Button</Button>
<Button>Second Button</Button>
</StackPanel>
Here, each Button is a child element of StackPanel. This is a streamlined and intuitive markup that omits two tags for two different reasons.
  • Omitted StackPanel.Children property element: StackPanel derives from PanelPanel defines Panel.Children as its XAML content property.
  • Omitted UIElementCollection object element: The Panel.Children property takes the type UIElementCollection, which implements IList. The collection's element tag can be omitted, based on the XAML rules for processing collections such as IList. (In this case, UIElementCollection actually cannot be instantiated because it does not expose a default constructor, and that is why the UIElementCollection object element is shown commented out).
<StackPanel>
<StackPanel.Children>
<!--<UIElementCollection>-->
<Button>First Button</Button>
<Button>Second Button</Button>
<!--</UIElementCollection>-->
</StackPanel.Children>
</StackPanel>

Routed Events

A particular event feature that is fundamental to WPF is a routed event. Routed events enable an element to handle an event that was raised by a different element, as long as the elements are connected through a tree relationship. When specifying event handling with a XAML attribute, the routed event can be listened for and handled on any element, including elements that do not list that particular event in the class members table. This is accomplished by qualifying the event name attribute with the owning class name. For instance, the parent StackPanel in the ongoing StackPanel / Button example could register a handler for the child element button's Click event by specifying the attribute Button.Click on the StackPanel object element, with your handler name as the attribute value. For more information about how routed events work, see Routed Events Overview.

Thursday 22 January 2015

(MVA) Microsoft Visual Academy

 
 Microsoft Visual  Academy (MVA)

 
 
 
 The Microsoft Virtual Academy (MVA) is a free online school with courses that cover Microsoft-related topics and specific Microsoft products.
 

The MVA offers a mix of on-demand courses and live events; each course contains a video and PDF download of the video transcript.  A self-assessment component is available at the end of each module. Students are awarded points and can move to different levels of recognition based on the progress they make.  Points are earned by watching videos, downloading video transcripts and self-assessment quizzes; the more points a member earns, the more opportunities she is given to participate in other MVA offerings. A leader board tracks the most active members. Although MVA offers free training for Microsoft certifications, members cannot earn certification directly through the Academy.
 
Topics offered through the MVA include business intelligence (BI), server infrastructure, desktop management and device security, licensing, programming and cloud computing. The coursework is designed to help lifelong learners work more effectively with Microsoft Lync, SharePoint, System Center, Office 365, SQL Server, Visual Studio, Windows Azure, Windows Phone and Windows Intune.

MVA is free for anybody interested in advancing their career through training on Microsoft technologies. You can watch or download up to three pieces of content (such as videos, slides, Q&A transcripts) without signing in, but to get full access to all videos and training resources available, including our live, interactive events, you will need to use a Microsoft account and create an MVA profile. Your profile will become a record of the time you invest here, including the certificates of completion for the courses you take.

Watch courses or attend a live event to build your skills
To get started, simply pick a course that interests you and begin watching the videos in each module. You’ll be able to download the presentations and also test your learning with quizzes. Once you have completed every action in a course, you will get a certificate of completion. When you attend a live event, you also have real time access to experts who can answer your questions during the training.


Track your progress and get recognized
On My Dashboard, you can manage personal learning plans and see how much of each course you have completed so that you can chart a course towards your goals. My Dashboard also records points for your learning actions and completed courses, and stores your certificates of completion which are available for you to download and print. Your point total reflects the commitment you’ve made to skilling up and lets you see how you compare to other students in your country and globally.

Link:-http://www.microsoftvirtualacademy.com/
 
 

Android Studio Project Structure

Android Project Structure In this blog i have explained Android project structure and file organization in detail, by creating a new An...