This action might not be possible to undo. Are you sure you want to continue?
You may want to try: PSAM WPF Control Library WPF Tutorial : Beginning
9,210,424 members and growing! Email Password Sign in Join highlights off Lost password?
introduction to wpf
» Platforms, Frameworks & Libraries » Windows Presentation Foundation » General
Important FAQ questions for WPF and Silverlight
By Shivprasad koirala | 9 Aug 2010 | Article
C # .NET Dev XAML WPF Intermediate Silverlight
Licence First Posted Views Downloads Bookmarked
C POL 24 Mar 2009 93,360 1,129 198 times
Part of The WPF / Silverlight Zone sponsored by
More like this More by this author
Twenty one important FAQ questions for WPF and Silverlight.
Article Browse Code Stats Revisions (12) Alternatives
4.85 (78 votes) 20 Hot News: Windows 8 review: Yes, it's that bad The C ode Project Insider. Free each morning.
Download source code - 535 KB
Video demonstration One Way, Two Way, and One Time Bindings using Silverlight
Introduction What is the need for WPF when we have GDI, GDI+, and DirectX? How does hardware acceleration work with WPF? Does that mean WPF has replaced DirectX? Can we define WPF in a precise way? What is XAML? Is XAML meant only for WPF? Can you explain the overall architecture of WPF? Which are the different namespaces and classes in WPF? The different elements involved in a WPF application What are dependency properties? Are XAML files compiled or built at runtime? Can you explain how we can separate code and XAML? How can we access XAML objects in behind code? What is Silverlight? Can Silverlight run in other platforms other than Windows? Come on, even WPF runs under browser, why Silverlight? What is the relationship between Silverlight, WPF, and XAML? Can you explain the Silverlight architecture? Source code Other Silverlight FAQ
Introduction to Attached Behaviors in WPF Introduction to WPF Introduction to WPF Templates Introduction to the WPF DataGrid WPF Introduction: Databinding +
GDI not only provides drawing capabilities but also a high level of abstraction on hardware display. GDI+: GDI+ was introduced which basically extends GDI and provides extra functionalities like JPG and PNG support.zip. WWF. it encapsulates all complexities of hardware in the GDI API. GDI+. This article not only explains the theory aspect of these technologies.Styles + IValueC onverter Introduction to C omposite WPF (C AL. gradient shading. SQL Server. What is the need for WPF when we have GDI.codeproject. WCF. but also shows small samples for each of them. GDI (Graphics Device Interface): Microsoft introduced GDI to provide drawing capabilities.Introduction SilverLight Introduction XLINQ Introduction Part 3 Of 3 Introduction to WF (Part01) LINQ Introduction Part 1 Of 3 Introduction This article talks about 21 important FAQ from the perspective of WPF and Silverlight. The biggest issue with the GDI API was it did not use hardware acceleration and did not have animation and 3D support.questpond.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 2/18 . Prism): Part 1 Introduction to C omposite WPF (C AL. and DirectX? First let’s try to understand how Microsoft display technologies have evolved: User32: This provides the Windows look and feel for buttons and textboxes and other UI elements.NET Introduction to . Prism): Part 2 Introduction to WPF Data Binding Introduction to D3DImage An Introduction to Silverlight Introduction to wxWidgets . Here’s a complete free e-book covering 400 FAQ for C#. RavenDB .com/SampleDotNetInterviewQuestionBook. WPF. and a lot more. User32 lacked drawing capabilities. Both of these technologies are connected to a certain extent.NET Introduction to NLog Introduction to wxWidgets WC F by Example .2. In other words.An Introduction Introduction to Anthem. and anti-aliasing. Note: Hardware acceleration is a process in which we use hardware to perform some functions www. feel free to download it and enjoy: http://www.
This came as a big disadvantage for game developers. F o D c m n .codeproject. To answer and serve game developers. WPF: Microsoft had 3 to 4 different APIs for display technologies. then WPF uses the Tier 2 rendering mode. you can not only build simple UI elements but also go one step further and develop special UI elements like G i . Depending on that. This corresponds to the working of DirectX versions less than 7. DirectX: The biggest issues with GDI and its extension GDI+ are hardware acceleration and animation support. had support for 3D. In other words. F o D c m n . full color graphics. and E l p e utn rd lwouet l i s ). In other words. Tier 1. WPF is a collection of classes that simplifies building dynamic user interfaces.0. WPF will be a good choice. WPF exploits hardware acceleration in a two tier manner. B t o ). and lots more. This corresponds to working of DirectX versions between 7. This API did not mature in the gaming industry. etc. then WPF uses the Tier 0 rendering mode. As WPF stands on top of DirectX.. This corresponds to working of DirectX versions equal or greater than 9.0 and 9. Microsoft developed DirectX. Tier 1: If the video card supports partial hardware acceleration. per pixel value. WPF is not meant for lis. and some that are new (such as G i .0. game development. media streaming facility. then WPF uses the Tier 1 rendering mode. so why one more? DirectX had this excellent feature of using hardware acceleration. In case you are looking for light animation (not game programming). Tier 2: If the video card supports hardware acceleration. some of which mimic old UI elements (such as L b l T x B x ae.0. Those classes include a new set of controls. you can go one step further and build animations. Microsoft wanted to develop UI elements like textboxes. using the DirectX technology by which they could exploit the hardware acceleration feature. eto. or Tier 2 rendering mode. Tier 0: If the video card does not support hardware acceleration.rather than performing those functions using software running in the CPU. You can also express WPF using XML which is also called as XAML. grids. Let’s now define WPF. WPF is a wrapper built over DirectX. DirectX still will lead in that scenario.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 3/18 . it uses a Tier 0. rd lwouet and E l p e Oh yes. etc. How does hardware acceleration work with WPF? Hardware acceleration is a process in which we use hardware to perform some functions rather than performing those functions using software running in the CPU. Does that mean WPF has replaced DirectX? www. it uses software acceleration. The WPF API first detects the level of hardware acceleration using parameters like RAM of video card. DirectX exploited hardware acceleration. buttons.
So XAML is an XML document which defines objects and properties and WPF loads this document in actual memory. The XAML parser instantiates objects and sets their properties. A XAML document is loaded by a XAML parser. controls. User32: It decides what goes where on the screen. XAML describes objects. It has three major sections: presentation core. WPF is a two and three dimensional graphics engine. you can create any kind of objects. So is XAML meant only for WPF? No. Has all of the capabilities of HTML and Flash. Silverlight XAML is a subset of WPF XAML meant for Silverlight applications. WPF does not replace DirectX. etc. Fixed and flow format documents. Can we define WPF in a precise way? Windows Presentation Framework is the new presentation API.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 4/18 . So let’s go section by section to understand how everything works.No. The video performance of DirectX is still many times higher than the WPF API. Oh yes. XAML is an XML-based language and it has several variants. we also have XPS XAML which defines an XML representation of electronic documents. What is XAML? XAML (pronounced as Zammel) is a declarative XML-based language by which you can define objects and properties in XML. It has the following capabilities: Has all equivalent common user controls like buttons. and audio and video. 2D and 3D vector graphics.codeproject. the preference will always be DirectX and not WPF. In the same diagram. Milcore: Mil stands for media integration library. you can make a tic tac toe game with it but not high action animation games. WWF XAML helps us describe Windows Workflow Foundation content. DirectX will still be needed to make cutting edge games. and the relations between them. Multimedia. WPF is not an optimum solution to make games. animation. graphical or non-graphical. WPF parses the XAML document and instantiates the objects and creates the relations defined by the XAML. DirectX: As said previously. check boxes. Animation. Data binding. and documents. presentation framework. sliders. In WPF XAML. XAML is not meant only for WPF. One point to remember: WPF is a replacement for Windows Forms and not DirectX. So when it comes to game development. The WWF engine then uses this XAML and invokes the workflow accordingly. Using XAML. Can you explain the overall architecture of WPF? The above figure shows the overall architecture of WPF. we can see how other sections like DirectX and Operating System interact with the system. and Milcore. Silverlight is a crossplatform browser plug-in which helps us create rich web content with two-dimensional graphics. such as WPF objects. WPF uses DirectX internally. properties. DirectX talks with drivers and renders the content. This section is unmanaged code because it acts www. WPF XAML is used to describe WPF content.
and events. rather than using methods.like a bridge between the WPF managed and the DirectX / User32 unmanaged API. Presentation core: This is a low level API exposed by WPF providing features for 2D. System. how drawing should be done iul like clipping. System. Which are the different namespaces and classes in WPF? There are ten important namespaces / classes in WPF. etc. etc. iul www. In the coming sections. and other functionalities.codeproject. i. WPF works on an STA model. button clicks. System. If you want to create your own customized user interface.dll and the WPF managed classes.Visual The V s a class is a drawing object which abstracts drawing instructions.Windows. Presentation framework: This section has high level features like application controls. In other words.. For now. The V s a class also acts like a bridge between the iul unmanaged MilCore. 3D.DispatcherObject All WPF objects derive from D s a c e O j c .DependencyObject When WPF was designed. functions. we have dedicated questions for this. a property based architecture was considered.Media.Threading. etc.Windows. object behavior will interact using properties. content. they are sent to the D s a c e O j c which ipthrbet verifies whether code is running on the correct thread. Single Threading ipthrbet Apartment model.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 5/18 . opacity.e. we will look in detail how WPF threading works. which helps you build up your application.. we will only restrict ourselves to this definition.. The main duty of this object is to handle concurrency and threading. geometry. In the coming sections. it can be iul displayed on windows. When a class is derived from V s a . layouts. are initiated. then you can program using V s a objects. When messages like mouse clicks.
Controls.Controls. Note: For this sample. Start VS 2008 Express and from Templates. etc.Control This class has controls like T x B x B t o .com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 6/18 . System. and events. foreground and background colors. select WPF Application as show in the figure below. System. oiotllgmn. such as the L s B xand ito TeVe. and path. These containers are the foundation of the WPF layout system. This can start from a simple label and go down to a unit level of string in a layout panel using shapes. input.System.Windows.Windows.Controls. we will do a small ‘hello world’ sample and in that process.Shapes. utn ito.ItemsControl This is the base class for all controls that show a collection of items. L s B x etc.UIElement U E e e thandles three important aspects: layout.Windows. H r z n a A i n e t V r i a A i n e t margins. It adds some extra properties like font. polygon.FrameworkElement F a e o k l m n uses the foundation set by U E e e t It adds key properties like rmWrEeet Ilmn. ellipse.Windows.Controls.ContentControl It holds a single piece of content. etcllgmn. www.Panel This class is used for all layout containers—elements that can contain one or more children and arrange them as per specific layout rules. The different elements involved in WPF application In order to understand the different elements of WPF. reiw System. eto. line. Ilmn System. System. System.Shape This class helps us create basic shapes such as rectangle. and using them is the key to arranging your content in the most attractive and flexible way possible.Windows.Windows. we have VS 2008 Express edition.codeproject.Windows. we will understand the different elements of WPF.
B t o elements in the XAML file map to a pApiain. The first code which runs in the application is the v i m i ( method from App.Once we have created the WPF Application project. App. the W n o element idw maps to the W f p l c t o 1 W n o 1class. i d w .XAML. o t o . If we you look at the code for App.XAML file od an) for rendering.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 7/18 . you will see a reference to the XAML file which needs to be loaded.oto. you will see two file types: the XAML file and the behind code.CS are the entry point files.CS. Every XAML element maps to some class. For instance.codeproject.CS which in turn loads the Window1. www. and the G i XAML elements map to ytmWnosCnrlBto rd Sse.idw utn S s e .cs. XAML files are nothing but XML files which have all the elements needed to display the window's UI.XAML and App.idw.e.XAML. i.rd ytmWnosCnrlGi. XAML. u t nclass..XAML.
Consider the code snippet below: www. What are dependency properties? Dependency properties belong to one class but can be used in another. So yutnCik yutnCik now if you run the code.We can now connect the behind code method and functions to the events in the XAML file elements. M B t o _ l c is the method which is in the XAML. you can see the message box. you can see the button and if you click on it.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 8/18 .CS behind code.codeproject. You can see from the above code snippet how the B t o element has the C i kevent linked to the utn lc M B t o _ l c function.
in the below code snippet.XAML will have a Shiv. For instance. When we build a XAML based project. www.et"4 Cna. you need to specify the x C a sattribute.g. But if you want to do runtime parsing of a XAML file. o and C n a . it also allows that to be done. you will see it creates a g. you just need to define them with the same name as given in the XAML document. But they also support parsing during runtime. we have named the object as o j e t btx and the object is defined with the same name in the behind code. a Shiv. In order to associate a class with a XAML file. e tare egt it etnl. Therefore.cs extension in the obi\Debug folder. :ls Any event specified on the XAML object can be connected by defining a method with sender and event values.1: XAML and behind code in action Above is a code snippet which shows a XAML file and the code completely detached from the XAML presentation. Note: You can find a simple sample in the WindowsSimpleXAML folder.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 9/18 . How can we access XAML objects in behind code? To access XAML objects in behind code. you will find a g.C ollapse | C opy C ode <etnl Hih=7"Wdh"3"Cna. It is used by the R c a g eto specify its avs etnl position within C n a . you actually do not see the XAML file. for every XAML file.codeproject. avs Are XAML files compiled or built at runtime? XAML files are usually compiled rather than parsed at runtime. In short.o=7"/ Rcage egt"2 it=11 avsLf=7" avsTp"7 > H i h and W d hare regular properties of the R c a g e But C n a . You can see from the above code snippet that we have linked M C i k v n to an event in ylcEet the behind code.cs file in the obi\Debug folder. So designers can independently work on the presentation of the application and developers can actually write the code logic independent of how the presentation is. Figure 16. at runtime. Feel free to experiment with the code… experimenting will teach you more than reading something theoretical. avsTp avsLf dependency properties as they belong to the C n a class. Can you explain how we can separate code and XAML? This is one of the most important features of WPF. For instance.cs file. separating the XAML from the code to be handled.
So let’s run through some basic points regarding the IDE view that we see. www.NET web project to the solution to host Silverlight: This option is the default option. Once you click OK.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 13/18 . Link this Silverlight control into an existing website: If you have an existing Silverlight application. If you want to only concentrate on your Silverlight application. You will see there are two projects: your web application and the Silverlight application.XAML and Page. You will not see this option enabled in new projects. then this option is worth looking at.codeproject. Step 4: Now for simplicity's sake. and it will create a new Web Application project that is configured to host and run your Silverlight application. you should see the full IDE environment for Silverlight. we have selected the first option.XAML has the global level information. then this option helps to link the Silverlight application with the existing web application project. then this is the option to go. we just use the T x B o ktag to display a text. Automatically generate a test page to host Silverlight at build time: This option will create a new page at runtime every time you try to debug and test your application.XAML.Add an ASP. In the Silverlight application. it is displayed in the viewer. you need to have an existing web application.XAML. App. For this example. You can see etlc that as we type in Page. we have two XAML files: App. If you are creating a new Silverlight application.
design pattern .questpond. C# . WCF . We are very much active in making training videos .aspx Silverlight FAQ Part 2: SilverLight FAQ's . UML . LINQ . SQL Server training and Interview questions and answers Architect http://www. is licensed under The Code Project Open License (CPOL) About the Author Shivprasad koirala I am a Microsoft MVP for ASP/ASP.codeproject. ASP. Sharepoint .NET .Source code You can download the source code here.NET.NET . Silverlight . Do visit my site for .Part2 Silverlight FAQ Part 3: SilverLight FAQ's . thank you for sharing Sign In · View Thread · Permalink My vote of 5 Vinod Satapara 19:32 27 Feb '12 100/100 Sign In · View Thread · Permalink www. writing books and corporate trainings.NET and currently a CEO of a small E-learning company in India.Part3 One-Many and One-One relationships using LINQ to SQL: One-Many and One-One relationship using LINQ to SQL License This article. Other Silverlight FAQ LINQ FAQ Part 1: http://www.com/KB/linq/LINQNewbie.com India Member Article Top Sign Up to vote Poor Excellent Vote Comments and Discussions You must Sign In to use this message board.. Search this forum Profile popups Noise Medium Layout Expand Posts & Replies Refresh My vote of 5 Madhan Mohan Reddy Per page 25 Go Update First Prev Next 23:28 15 Jul '12 Really helpful information.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 15/18 . ADO. along with any associated source code and files.codeproject..
.. thanks in advanced.. Rating always. Use http://www...com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 16/18 ...codeproject.Very well written and informative Member 8113189 1:25 26 Jul '11 y well written and informative Sign In · View Thread · Permalink My vote of 5 aydinsahin 11:13 29 Oct '10 good article Sign In · View Thread · Permalink My vote of 5 Ganeshpandi 11:04 29 Oct '10 Very good article Sign In · View Thread · Permalink My vote of 5 AmolPandurangBorkar 23:54 15 Sep '10 Thanks for the nice article Sign In · View Thread · Permalink can we use silverlight in windows development application ? 20:44 3 Sep '10 koolprasad2003 Good article. can we use silvelight in windows based application. i have a problem.. Nicely explaind the fundamentals of WPF.google..... Isn't that more relevant to Attached proeprties rather then just dependency property? Sign In · View Thread · Permalink Simply Superb! Arfan Baig 21:19 18 Mar '10 Great article! Really helpful.00/5 (1 vote) 21:51 12 Sep '09 Very Nice helps a lot!!! Sign In · View Thread · Permalink Really Nice Sathishkumar_P 2:05 24 Aug '09 Very helpful and really nice article Shiv Sign In · View Thread · Permalink Excellent 8:40 2 Jul '09 Cybernate www.. I am not sure but the example you showed for dependency property looks a bit sonfusing to me.com/transliterate/ for translator Sign In · View Thread · Permalink Nice article Member 4178170 23:48 26 May '10 Nice article Sign In · View Thread · Permalink Great Article but is the example of dependency property right? 2:40 24 Mar '10 akjoshi Hi. Sign In · View Thread · Permalink Very Nice gaoyuegl 5. Really good article.Because Opprtunity Knock softly... WELCOME Be a good listener.
etc. MCSD.net[web]) Netprosys Inc. MCPD.com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 17/18 . Bill Resse created SilverSprite.netprosys. Thanks for the great work. July 24. High level 3D abstractions can be defined in XAML and lower level processing can be routed to lower level API's. and last I want to help me to found discription about namespaces used in WPF? and thank you again. etc. Cybernate Sign In · View Thread · Permalink Nice format! However. prasad Sign In · View Thread · Permalink What is WPF namespace? o3yoon 19:02 10 Apr '09 first I want to thank you for this great article.000. DirectX.com/Thread/List. Regards. make 5 Project Hostage) any Compnay Hire him will pay 30. OpenGL. TheArchitectualizer 2:35 30 Jun '09 Hmm. 2008 5:33 PM Sign In · View Thread · Permalink Nice Stuff wasimsharp 19:02 30 Mar '09 Coool really good for newbie WANTED wasim khan(Killed 50 Innocent Buggs.net. Sign In · View Thread · Permalink good pictorial representation vikas amin 1. Silverlight 2 has no hardware acceleration. Silverlight 3 will bring Hardware accelaration: PixelShaders..codeplex. PhysicsX.net.00/5 (1 vote) 9:39 7 Apr '09 Hi shivprasad good pictorial representation Vikas Amin My Article's on CP modified on Thursday.aspx[^] ~TheArch Sign In · View Thread · Permalink Nice! prasad02 19:50 1 Jun '09 Nice! Thanks and Regards. Best place where u can get him is Sorcim Technologies Murre Road RWP Sign In · View Thread · Permalink Very nicely Explained koirala kamii47 4:06 25 Mar '09 Very nicely Explained koirala. WPF can leverage HSLS. Software Engineer (MCP. WPF and Silverlight are both sutiable platforms for game design and development. for 2D Sprite based games. www. Distroyed 200 Exception.com www.codeproject. a port of XNA to Silverlight. However. Kamran Shahid Sr. HLSL. MCTS. MCAD. Designers can still design in 3D and Developers can abstract the lower level stuff.. CUDA. http://silversprite. it is sandboxed and can not be extended.Well structured article.
2 0 1 2 T erms of U s e www.00/5 (1 vote) 1 P ermalink | A dvertis e | P rivac y | M obile Web0 1 | 2 .2 | L as t U pdated 1 0 A ug 2 0 1 0 L ayout: fixed | fluid A rtic le C opyright 2 0 0 9 by Shivpras ad koirala E verything els e C opyright © C odeP rojec t.5 .Sign In · View Thread · Permalink Very Very Nice dishatera 4:32 24 Mar '09 Its rare to see such articles. Sign In · View Thread · Permalink Last Visit: 23:34 21 Aug '12 General News Last Update: 16:32 24 Aug '12 Suggestion Question Bug Answer Joke Rant Admin 5. 1 9 9 9 .com/Articles/34433/21-Important-FAQ-questions-for-WPF-and-SilverLight 18/18 .codeproject.1 2 0 8 2 0 .
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.