Posts tagged StartWith WPF
Half of the battle can be won through UI and Control placement in software paradigm .All of us know the a good UI leaves extraordinary impact on user so this post is all about control placing and control layout in WPF.In this post we will cover following topics.
- Classic Controls
Layout in WPF are versatile than win form controls.In Win form most of the frequently used layouts used the coordinate based control placement while in WPF it is slot based depending on the screen space.the most common used layouts in wpf are as follows :
||Used Coordinate based Control Layout (Same as panel in normal Win Form)|
||Control are placed horizontally / Vertically one above the other|
||Controls are placed sequentially horizontally / vertically|
||Creates column,Row based grid and each cell allows controls to be placed|
||Docks the control on specified area|
A collected sample of all can be seen bellow
More details can be found http://msdn.microsoft.com/en-us/library/ms745058.aspx.
The control set in WPF is rich with wide support for data binding .A full comparison of WPF and winform control can be found from here.
Additional Link for Controls
Learning a new programming platform is never easy until unless somebody is really inspired.WPF (Windows Presentation Foundation ) is quite convincing if you look at its prospective and the capability it gives to user.This new graphical subsystem from Microsoft relies on Direct X for rendering instead of GDI.So the advantage this declarative programming model is Resolution Independent provides extensive integration with independent technology (Text to speech , 3d animation ,video etc),Hardware acceleration with Direct 3d and most useful complete customization of controls.
Wpf applications development can be of two type
- Windows Based Application
- Browser Based Application (XBAP)
|What is Declarative Programming ?|
This Blog post is about my experience with first WPF application , a simple application with basic understanding.
Create a WPF Project :
Open Visual Studio and Select WPF Application .Provide a Name “StartWithWpf” and click Ok .
Have a look at the source folder , It contains a default MainWindows.xaml and App.xaml.So the XAML Markup drives WPF application with similar syntax of XML (Read More about XAML and Syntax) .A complied form of XAML is known as BAML.
Digging Into APP.Xaml:
The App.Xaml (Application class )is the entry point for the application .We can write as code behind application class or in the mark-up.The declarative Mark-up is must for XBAP.
So the app.xaml need above lines to run a project.These are the Attributes of Application .
xmlns –:Defines the Namespace for the Application
xmlns : x-:Defines the additional namespace for the application
Above both attributes direct to the specification required to be referenced for xaml.You can find out some additional references as you add your some custom namespaces.
Adding a Form:
Now the look at the Window , we have added.
I will change the Title property and add a label to the Grid Layout.(Layouts are very important in WPF ).
- <Window x:Class=”StartWithWpf.MyFirstWindow”
- Title=”Home” Height=”300″ Width=”300″
- <Label> My First WPF Application </Label>
Now to Run the application i will go to App.xaml and Change the StartUpUri attribute to “MyFirstWindow.xaml”.Lets run it and you are ready with your first WPF application.A simple but fair start .