V 1.1 Programming III. Important events, properties, methods of UI elements XAML basics.

Slides:



Advertisements
Similar presentations
Ali Alshowaish w3schools. XML documents use a self-describing and simple syntax: The first line is the XML declaration. It defines the XML version (1.0)
Advertisements

Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
ICS-FORTH 1 May 22, 2001 Christos Georgis The extensible markup language: An introduction to XML What is a XML document ? How do we check its validity.
Dinko Jakovljević Microsoft Student Partner | BambooLab
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Painter Application Introducing Graphics with Windows Presentation Foundation.
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
CS 898N – Advanced World Wide Web Technologies Lecture 21: XML Chin-Chih Chang
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
Sistemi basati su conoscenza XML Prof. M.T. PAZIENZA a.a
XML Primer. 2 History: SGML vs. HTML vs. XML SGML (1960) XML(1996) HTML(1990) XHTML(2000)
Introducing HTML & XHTML:. Goals  Understand hyperlinking  Understand how tags are formed and used.  Understand HTML as a markup language  Understand.
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
HTML DOM.  The HTML DOM defines a standard way for accessing and manipulating HTML documents.  The DOM presents an HTML document as a tree- structure.
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.
V 1.0 Programming III. Creation of additional windows Routed events.
Pemrograman Berbasis WEB XML -Aurelio Rahmadian- Sumber: w3cschools.com.
XML CPSC 315 – Programming Studio Fall 2008 Project 3, Lecture 1.
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
1 Intro XAML Attribute syntax & property syntax Panels Reusable resources Controls Data binding Steen Jensen, spring 2014.
V 1.1 Programming III. GUI APIs WPF Hello World Important UI elements UI elements / content models UI elements / inheritance.
August Chapter 2 - Markup and Core Concepts Learning XML by Erik T. Ray Slides were developed by Jack Davis College of Information Science and Technology.
V 1.0 Programming III. Comparison of GUI APIs WPF Hello World UI elements Content models Inheritance chains.
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
V 1.1 Programming III. Creating additional windows Event handling: preview/routed events.
V 1.0 Programming III. Automatic notifications (…Changed, INofityPropertyChanged, ObservableCollection ) Data formatters Data conversions Resources.
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
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.
WEB APPLICATION DEVELOPMENT For More visit:
Consuming eXtensible Markup Language (XML) feeds.
17 Apr 2002 XML Syntax: Documents Andy Clark. Basic Document Structure Element tags – Elements have associated attributes Text content Miscellaneous –
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
What it is and how it works
XML Introduction. Markup Language A markup language must specify What markup is allowed What markup is required How markup is to be distinguished from.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
 defined as Extensible Markup Language (XML) is a set of rules for encoding documents  Defines structure and data.
Introduction to XML XML – Extensible Markup Language.
DTD ]>. Internal DTD Declaration ]> Faculty Director Reminder Please be regular in your classes.
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML.
V 1.0 Programming III. Automatic notifications with data binding (…Changed, INofityPropertyChanged, ObservableCollection, DataTemplate) Data formatters.
Host Objects: Browsers and the DOM
CPSC 481 – Week #7 Sowmya Somanath
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.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
XML Extensible Markup Language
XML Introduction to XML Extensible Markup Language.
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Chapter 6 © 2003 by Addison-Wesley, Inc Introduction - Dynamic HTML is not a new markup language - A dynamic HTML document is one whose tag attributes,
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 5 Host Objects: Browsers.
Extensible Markup Language (XML) Pat Morin COMP 2405.
Programming III. XAML basics.
Unit 4 Representing Web Data: XML
Validating User Input Lesson 5.
XAML User Interface Creation in C#
.NET and .NET Core 7. XAML Pan Wuming 2017.
Events.
Introduction to jQuery
Web Development Using ASP .NET
JavaScript and Events CS Programming Languages for Web Applications
JavaScript and Events CS Programming Languages for Web Applications
Brown Bag Seminar Summer 2007
Presentation transcript:

V 1.1 Programming III. Important events, properties, methods of UI elements XAML basics

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Input (inherited from System.Windows.UIElement) –Visibility, IsVisible –Focusable, IsFocused – can receive keyboard input –IsHitTestVisible – using mouse or other device –IsEnabled – if not, then „greyed out” –AllowDrop –CommandBindings – pure MVVM – not in our schedule –IsTabStop, TabIndex 2

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Input (inherited from System.Windows.UIElement) –IsMouseOver –IsMouseCaptured AreAnyTouchesOver, …Captured … IsStylusOver, …Captured … –CaptureMouse(), CaptureStylus(), CaptureTouch() – Independent from the location of the input device –ReleaseMouseCapture(), ReleaseStylusCapture(), ReleaseTouchCapture() – Turn off the input capture –Focus() – This is for the keyboard input only 3

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Input (inherited from System.Windows.UIElement) –KeyDown –KeyUp –MouseDown, MouseLeftButtonDown, MouseRightButtonDown … –MouseUp, MouseLeftButtonUp, MouseRightButtonUp … –MouseEnter –MouseLeave –MouseMove –MouseWheel –MouseDoubleClick –Other important events: Touch events (Touch…), Stylus events (Stylus…) Drag&drop events (Drag…) –Special methods for the manipulation of event handlers RaiseEvent(), AddHandler(), RemoveHandler() 4

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Load (inherited from System.Windows.FrameworkElement) –Initialized – After the execution of the constructor, all properties are set –Loaded – Layout and data binding are fully completed, before display –IsInitialized, IsLoaded 5

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Basic style (inherited from System.Windows.FrameworkElement) –(Max/Min/-)Height, (Max/Min/-)Width –Margin – outside the element –Padding – inside the element –Triggers – pure MVVM – not in our schedule –Language –BringIntoView() – e.g. if scrolled outside 6

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Advanced style (inherited from System.Windows.Controls.Control) –Background, Foreground –BorderBrush, BorderThickness –FontFamily, FontSize, FontStretch, FontStyle, FontWeight –HorizontalContentAlignment/VerticalContentAlignment –Template – The object that determines actually how the properties above will be used. Without a template, they have no meaning. A default template exists for all visible controls 7

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Content (inherited from ContentControl) –Content –HasContent –ContentStringFormat, ContentTemplate – affects how the content is displayed 8

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Content (inherited from ItemsControl) –Items, ItemsSource –HasItems –ItemStringFormat, ItemTemplate – affects how the individual items are displayed (ItemTemplate is the only template we’ll use this semester) –IsTextSearchEnabled, IsTextSearchCaseSensitive 9

V 1.1ÓE-NIK, 2015 Important events, properties, methods of UI elements Naturally all the classes have specific properties/events on their own E.g: –Button: Click event –TextBox: Text property –TextBox: LineCount property –TextBox: SelectionStart, SelectionLength, SelectedText properties –TextBox: GetLineLength(), GetLineText(), ScrollToLine() methods –TextBox: Select(), Clear()… methods –RadioButton: GroupName property – defines the radiobuttons that belong to one group (only one of them can be selected) 10

V 1.1ÓE-NIK, 2015 XML (w3schools.com) Hierarchical way to describe DATA XML declaration + nodes + attributes –Nodes:... = –Attributes: within the category=“…” … 11 Everyday Italian Giada De Laurentiis Learning XML Erik T. Ray

V 1.1ÓE-NIK, 2015 XML Strict rules apply – well-formed XML! –First line: optional format specifier, with definition of encoding : –Every node can contain: Text Sub nodes Attributes –There has to be exactly one root element ( ) –Closing a tag is obligatory ( or ), with good nesting –The whole document is case-sensitive 12

V 1.1ÓE-NIK, 2015 XML The nodes and the attributes can describe an object Using nesting, we can represent hierarchy – the XML always depends on the interpretation! 13 Everyday Italian Giada De Laurentiis

V 1.1ÓE-NIK, 2015 XAML (eXtensible Application Markup Language) XML-based language, where we describe the hierarchy and the properties of.NET objects –VALID xml !!! (not only well-formed) –We can use types that are not abstract and that have a default (zero-parameter) constructor Everything in the XAML could also be written in C# (or other languages in the CLR: language-independent) In the WPF we use it to build up a GUI When compiling a XAML... –msbuild.exe attaches it into the assembly as a binary resource –.g.cs ->.baml –The InitializeComponent() loads the XAML, which is called in the constructor 14

V 1.1ÓE-NIK, 2015 XAML XAML description: C# language: The XAML nodes actually mean the creation of an instance of a.NET class The attributes change the properties / event subscriptions 15 <CheckBox Content="Automatikus mentés" Name="checkBox1" IsChecked="True" Checked="checkBox1_Checked"/> CheckBox checkBox1 = new CheckBox(); checkBox1.Content = "Automatikus mentés"; checkBox1.IsChecked = true; checkBox1.Checked += checkBox1_Checked;

V 1.1ÓE-NIK, 2015 XAML Setting the content explicitly: Property syntax: sub-node Setting the content implicitly: According to the XAML specs: the immediate children set the Content Property, but this property is not necessary the actual Content (for ItemsControl/Layout managers, the immediate children set the Items/Children property) 16 <CheckBox Content="Automatikus mentés" Name="checkBox1" IsChecked="True"/> Automatikus mentés Automatikus mentés

V 1.1ÓE-NIK, 2015 XAML More complex content Using the Property syntax Syntax error – this is NOT a ContentControl descendant, there is no Content or anything similar 17 Automatikus mentés Automatikus mentés Automatikus mentés

V 1.1ÓE-NIK, 2015 XAML With the ItemsControl, the immediate children set the Items… With layout manaagers, the immediate children set the Children 18 Collection Syntax

V 1.1ÓE-NIK, 2015 XAML Collection Syntax –More then one sub-nodes can be specified, if the given property is a collection (IList, Array, IDictionary) –ListBox.Items, Grid.Children, etc

V 1.1ÓE-NIK, 2015 XAML Attached Property Syntax 20

V 1.1ÓE-NIK, 2015 Practice exercise 21