Dinko Jakovljević Microsoft Student Partner | BambooLab

Slides:



Advertisements
Similar presentations
Module 1: Creating an Application by Using Windows Presentation Foundation Overview of WPF Creating a Simple WPF Application Handling Events and Commands.
Advertisements

Master Pages, User Controls, Site Maps, Localization Svetlin Nakov Telerik Corporation
Expression Blend 4 – deep dive
Creating Windows Store Apps. 1. Overview of Windows Store applications 2. Worked example 3. Adding controls and event handlers Contents 2.
Introduction to Windows Presentation Foundation (WPF) Dr. Frank McCown COMP 445 – GUI Programming.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Painter Application Introducing Graphics with Windows Presentation Foundation.
Windows Presetation Foundation (WPF) 1. Introduction.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Using Microsoft SharePoint to Develop Workflow and Business Process Automation Ted Perrotte National Practice Manager, Quilogy, Microsoft Office SharePoint.
Brian Mpafe Microsoft DPE Intern Program.  The Visual Studio IDE  First Application (Hello World)  Second Application(News from Cameroon)
.NET Database Technologies: Introduction to WPF and Entity Framework DataBinding.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Overview of UI Development for Windows Store Apps
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
V 1.0 Programming III. XML XAML Data Binding I.. V 1.0ÓE-NIK, 2014 XML (w3schools.com) A hierarchical way of defining data XML declaration + elements.
1 COS240 O-O Languages AUBG, COS dept Lecture 33 Building Apps Technologies C# (WPF part 1)
WPF chapter 15 Dr. John Abraham Professor UTPA. WPF –an introduction WPF provides a single platform capable of handling graphics, audio and video. WPF.
Target: dependency property Source: any public property CLR and WPF properties Target: dependency property Source: any public property CLR and WPF properties.
Next Generation for Desktop Applications Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
1 Intro XAML Attribute syntax & property syntax Panels Reusable resources Controls Data binding Steen Jensen, spring 2014.
An Introduction to Silverlight Matt Harrington Developer Evangelist, Microsoft October 20, 2011.
Windows Presentation Foundation. Agenda Introduction Developing Applications WPF and WF interoperability Custom Controls Styles and Templates Data Binding.
Virtual techdays INDIA │ Nov 2010 Developing Office Biz Application using WPF on Windows 7 Sarang Datye │ Sr. Consultant, Microsoft Sridhar Poduri.
ASP.NET Web Server Controls Basic Web Server Controls.
Windows Presentation Foundation Adam Calderon Principal Engineer Interknowlogy LLC
1 Metro Style Apps in C++ Karthick 8 th May 2012.
V 1.0 Programming III. Automatic notifications (…Changed, INofityPropertyChanged, ObservableCollection ) Data formatters Data conversions Resources.
LAYOUT CONTROLS. XAML Overview XAML : eXtensible Application Markup Language pronounced (ZAMEL) is a markup language used to design user interfaces XML-based.
Object Oriented Software Development 9. Creating Graphical User Interfaces.
Introduction to Building Windows 8.1 & Windows Phone Applications.
Jaime Rodriguez | Microsoft Principal Technical Evangelist Laurent Bugnion | IdentityMine Senior Director XAML Deep Dive for Windows & Windows Phone Apps.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Svetlin Nakov Telerik Corporation
1 Tutorial 14 Validating Documents with Schemas Exploring the XML Schema Vocabulary.
Tutorial 13 Validating Documents with Schemas
A Lap Around Windows Presentation Foundation. Why hasn’t UX taken off in software? It’s Difficult! Animation 2D 3D Documents Styled Controls Video Windows.
Windows Presentation Foundation (WPF). Introduction Separates appearance of user interface from behavior Appearance usually specified by XAML Behavior.
Customizing Aspen Templates TEC04 Elizabeth Lucchese.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
TRAINING SESSIONS.NET Controls.  Standard Controls  Label  Textbox  Checkbox  Button, Image Button, Image control  Radio Button  Literal  Hyperlink.
ControlTemplate and DataTemplate Doncho Minkov Telerik School Academy Technical Trainer
Module 3 Designing and Developing a User Interface.
Object-Oriented Application Development Using VB.NET 1 Chapter 10 VB.NET GUI Components Overview.
1 Catching up on Rich Clients (round 1) Mike Ormond, Mike Taulty Developer & Platform Group Microsoft Ltd
Module 4 Taking Control of the User Interface. Module Overview Sharing Logical Resources in an Application Creating Consistent User Interfaces by Using.
V 1.0 Programming III. Automatic notifications with data binding (…Changed, INofityPropertyChanged, ObservableCollection, DataTemplate) Data formatters.
Positioning Objects with CSS and Tables
Module 1 Introducing C# and the.NET Framework. Module Overview Introduction to the.NET Framework 4 Creating Projects Within Visual Studio 2010 Writing.
V 1.0 Programming III. XAML Data Binding I.. V 1.0ÓE-NIK, 2014 XAML namespaces Namespaces define the allowed tags and attributes The one without the prefix.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Windows Presentation Foundation Ruwan Wijesinghe.
Soyatec Contents Needs Architecture XAML fundamentals Data Binding Advanced features Style Q&A.
WPF (Avalon), Windows App GUI Windows App GUI Web App GUI Web App GUI HTML HTML XML XML WPF WPF LINQ LINQ.
Part of the Microsoft.NET Framework 3.0 Tomer Shamam.NET Technologies Expert Sela Group
Data Binding, Binding Properties Doncho Minkov Telerik School Academy Technical Trainer
Adam Schultz MVVM and WPF. MVVM Model, View, ViewModel A software architecture designed to separate out User Interface design, Business Logic, and Data.
Jim Fawcett, Brown Bag Seminar Series Fall 2007
Introduction to Silverlight
In Windows 8 Store Applications
Important New Concepts In WPF
Jim Fawcett, Brown Bag Seminar Series Fall 2007
ASP.NET Web Controls.
Introduction to Silverlight
XAML User Interface Creation in C#
Introduction to Silverlight
WPF AKEEL AHMED.
.NET and .NET Core 7. XAML Pan Wuming 2017.
Web Development Using ASP .NET
Presentation transcript:

Dinko Jakovljević Microsoft Student Partner | BambooLab

Agenda About XAML Syntax Code-Behind XAML Namespaces and Namespace Mapping Data binding

About XAML

eXtensible Application Markup Language Declarative XML-based language Used for initializing structured values and objects XAML defines UI elements, data binding, eventing, etc.

About XAML Xaml elements map directly to CLR object instances (Common Language Runtime) Xaml attributes map to CLR properties and events on objects Everything that is implemented in XAML can be expressed in C# or VB.NET

Where we can find XAML?

About XAML Xaml filescan be created: Visual Studio Microsoft Expression Blend Various text editors (XAMLPad)

Why is XAML so interesting? 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

Why is XAML so interesting? XAML directly represents the instantiation of objects in a specific set of backing types defined in assemblies XAML enables a workflow where separate parties can work on the UI and the logic of an application, using potentially different tools.

Syntax

XAML is a language based on XML and follows or expands upon XML structural rules.

Little more syntax

Syntax 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.

C# Code StackPanel stackPanel = new StackPanel();new this.Content = stackPanel; Button button = new Button();new button.Margin= new Thickness(20);new button.Content = "OK"; stackPanel.Children.Add(button);

Attribute syntax 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

Property element syntax The content of tag is an object element of the type that the property takes as its value....

Property element syntax Pritisni me!

Attribute syntax (Events) Attribute syntax can also be used for members that are events rather than properties. Click Me!

Markup Extension Markup extensions are dynamic placeholders for attribute values in XAML. FontFamily="{StaticResource PhoneFontFamilyNormal}"

Markup Extension Built-in markup extensions: Binding StaticResource DynamicResource TemplateBinding x:Static x:Null

Elements XAML is the primary format for declaring a Silverlight UI and elements in that UI. Typically at least one XAML file in your project represents a "page" metaphor in your application for the initially displayed UI.

Grid Panel The grid is a layout panel that arranges its child controls in a tabular structure of rows and columns. Its functionality is similar to the HTML table but more flexible.

Grid Panel The grid has one row and column by default. RowDefinition item -> RowDefinition collection ColumnDefinition item -> ColumnDefinition collection

Grid Panel The size can be specified as an absolute amount of logical units, as a percentage value or automatically. Fixed Fixed size of logical units (1/96 inch) Auto Takes as much space as needed by the contained control Star (*) Takes as much space as available (after filing all auto and fixed size)

StackPanel In WPF is a simple and useful layout panel. It is good for creating any kind of lists. ItemsControls like ComboBox, ListBox or Menu use StackPanel as their internal layout panel.

Grid vs StackPanel

DEMO

Code behind

Code-behind is a term used to describe the code that is joined with markup-defined objects, when a XAML page is markup- compiled Click Me!

Code behind and XAML MainPage.xaml MainPage.xaml.cs XAML code Click Me! MainPage.xaml

Code behind and XAML MainPage.xaml MainPage.xaml.cs Code Behind MainPage.xaml.cs private void Press(object sender, RoutedEventArgs e) { }

Code behind and XAML namespace SSA_primjer { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); } private void Press(object sender, RoutedEventArgs e) { } }

Inline Code Click Me! <![CDATA[ void Clicked(object sender, RoutedEventArgs e) { button1.Content = "Hello World"; } ]]>

Inline Code x:Codex:Code is a directive element defined in XAML The code that is defined inline can interact with the XAML on the same page You should consider avoiding or limiting the use of inline code

DEMO

XAML Namespaces

What is a XAML Namespace? A XAML namespace is an extension of the concept of an XML namespace. It rely on the XML namespace syntax, the convention of using URI and so on.

XAML Namespace Declaration xmlns=" xmlns:x=" Within the namespace declarations in the root tag of many XAML files, you will see that there are typically two XML namespace declarations.

The XAML namespace defines many commonly-used features that are necessary even for basic WPF applications. XAML Namespace Declaration Code – behind to XAML file through a partial class x:Class Keyed resource of an element x:Key

Mapping to Custom Classes You can map XML namespaces to assemblies using a series of tokens within an xmlns prefix declaration. The CLR namespace declared within the assembly that contains the public types to expose as elements. clr-namespace:

Mapping to Custom Classes xmlns:custom="clr-namespace:SDKSample;assembly=SDKSampleLibrary"> <Page x:Class="WPFApplication1.MainPage" Example:

Data binding

Data binding provides a simple way for Windows Runtime apps using C++, C#, or Visual Basic to display and interact with data. A data binding consists of a target and a source.

Data binding When a binding is established and the data changes, the UI elements that are bound to the data can display changes automatically.

Data binding syntax The binding is created in XAML by using the {Binding...} The source is set in code by setting the DataContex property for the TextBox

Data binding

Data context Data context is inherited. A child element can override this behavior by setting the Source property on its binding object, or by setting its DataContext.SourceDataContext Useful when we have multiple bindings that use the same source.

Other sources ElementName property – useful when you are binding to other elements in your app (slider + width of button) RelativeSource property – useful when the binding is specified in a ControlTemplate

Other sources Binding.Path property – supports a variety of syntax options for binding to nested properties, attached properties.

Direction of the data flow

Change notification For changes to the source object to propagate to the target, the source must implement the INotifyPropertyChanged interface. INotifyPropertyChanged has the PropertyChanged event.

DEMO

?

Hvala na pažnji