Jim Fawcett, Brown Bag Seminar Series Fall 2007

Slides:



Advertisements
Similar presentations
Panels, Tab Containers Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
Advertisements

Master Pages, User Controls, Site Maps, Localization Svetlin Nakov Telerik Corporation
SpreadsheetML Basics.
Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
Building Localized Applications with Microsoft.NET Framework and Visual Studio.NET Achim Ruopp International Program Manager Microsoft Corp.
Dinko Jakovljević Microsoft Student Partner | BambooLab
Chapter 11 File Systems and Directories. 2 File Systems File: A named collection of related data. File system: The logical view that an operating system.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
Creating Multi-lingual Applications and Websites with Microsoft Visual Studio 2005 Achim Ruopp International Program Manager Microsoft Corporation.
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.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
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)
1 HTML References: A HTML Tutorial: /HTMLPrimer.html
Target: dependency property Source: any public property CLR and WPF properties Target: dependency property Source: any public property CLR and WPF properties.
Module 11 Control Customization. Module Overview Overview of Control Authoring Creating Controls Managing Control Appearance by Using Visual States Integrating.
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.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Windows Presentation Foundation. Agenda Introduction Developing Applications WPF and WF interoperability Custom Controls Styles and Templates Data Binding.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 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.
Chapter 11 File Systems and Directories. 2 File Systems File: A named collection of related data. File system: The logical view that an operating system.
Adam Calderon – C# MVP Application Development Practice Lead Interknowlogy.
Svetlin Nakov Telerik Corporation
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
Last time nav based apps navigationwindow and frame and page call navigate / hyperlink / journal... events pass data via extra arg, ctor, prop dictory.
V 1.0 Programming III. Converters Resources. V 1.0ÓE-NIK, 2014 Converters Data conversion: –Can be automatic! E.g.: SolidColorBrush  string, int  string.
ControlTemplate and DataTemplate Doncho Minkov Telerik School Academy Technical Trainer
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.
.NET Framework Presentation. About Me Patrik Löwendahl –C# MVP –Certified Vista Touchdown Trainer Cornerstone
IT533 Lectures ASP.NET AJAX.
Friday, March 8 Creating real Custom Controls Kelvin van Geene 12:15.
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.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL Windows Presentation Foundation Ruwan Wijesinghe.
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
Jim Fawcett, Brown Bag Seminar Series Fall 2007
Working with Cascading Style Sheets
Introduction to Silverlight
Windows Presentation Foundation
Chapter 2: The Visual Studio .NET Development Environment
INF230 Basics in C# Programming
Working in the Forms Developer Environment
Metropolia 2013 C# programming and .NET framework
Important New Concepts In WPF
Windows Presentation Foundation Layout with Panels
Architecture Concept Documents
Introduction to Silverlight
Jim Fawcett CSE775 – Distributed Objects Spring 2011
XAML User Interface Creation in C#
03 | Building Windows Store Apps with XAML Part 3
WPF AKEEL AHMED.
.NET and .NET Core 7. XAML Pan Wuming 2017.
Windows Presentation Foundation
Resources & Controls AKEEL AHMED.
Working with Multimedia
Using Cascading Style Sheets (CSS)
Week 1: File Systems and Directories
Web Development Using ASP .NET
Using Templates and Library Items
Creating a Windows Application Project in Visual Studio
1.3.7 High- and low-level languages and their translators
Sizing, Positioning, and Transforming Elements
Brown Bag Seminar Summer 2007
Presentation transcript:

Jim Fawcett, Brown Bag Seminar Series Fall 2007 WPF - Resources Jim Fawcett, Brown Bag Seminar Series Fall 2007

Reference Windows Presentation Foundation Unleashed, Adam Nathan, SAMS, 2007 Note: none of the material in this presentation is original from me. Everything has been drawn from Nathan’s book as paraphrases or quotations without quotes, with in some cases a little interpretation. Only a diagram or two is original.

Resources Binary Resources – used for years Bitmaps, strings, compiled XAML Logical Resources – New to WPF Arbitrary .Net objects named and stored in an element’s Resources property.

Packaging Binary Resources Embedded inside an assembly Loose files that are known to the application at compile time Loose files that might not be know to the application at compile time

Defining Binary Resources with Visual Studio Add file to Visual Studio project and select the appropriate build action in project properties Resource : Embeds resource into the assembly – may be a culture specific satellite assembly Content: Leaves the resource as a loose file, but adds a custom attribute to the assembly that records existence and relative location of the file.

Accessing Binary Resources Access with Uniform Resource Identifier (uri) A type converter enables uris to be specified in XAML as strings. <Image Height=“21” Source=“previous.gif” /> The image was included in the Visual Studio project with build action of Resource.

Localization If your application contains binary resources that are specific to certain cultures, you can partition them into satellite assemblies that get loaded automatically.

Logical Resources New WPF-specific mechanism Arbitrary .Net objects stored and named in an element’s Resources property. The base classes FrameworkElement and FrameworkContentElement both have a Resources property of type System.Windows.ResourceDictionary Most of the WPF classes derive from these base classes. These resources are often used to store styles or data providers.

Logical Resources <Window.Resources> <SolidColorBrush x:Key="backgroundBrush">Yellow</SolidColorBrush> <SolidColorBrush x:Key="borderBrush">Red</SolidColorBrush> </Window.Resources> <Window.Background> <StaticResource ResourceKey="backgroundBrush"/> </Window.Background> <DockPanel> <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center"> <Button Background="{StaticResource backgroundBrush}" BorderBrush="{StaticResource borderBrush}" Margin="5"> <Image Height="21" Source="zoom.gif"/> </Button>

Walking the Resources Tree The markup extension class implements the ability to walk the logical tree to find an item. First checks the current element’s Resources collection. If not found, it checks the parent element, its parent, etc, until it reaches the root element. If all that fails, it looks in the resources collection of the Application object. If that fails, it looks at the system default resources collection. If that fails, it throws an InvalidOperationException.

Static versus Dynamic Resources There are two ways to access a logical resource: Statically with StaticResource, meaning that the resource is applied only once when it is first needed. Dynamically with DynamicResource, meaning that the resource is reapplied every time it changes. A consumer of the resource sees changes, e.g., the resource is linked.

End of Presentation