Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
WPF Tutorial[Must C]-Layout-Panels-Containers & Layout Transformation

WPF Tutorial[Must C]-Layout-Panels-Containers & Layout Transformation

Ratings:
(0)
|Views: 16|Likes:
Published by Abhi

More info:

Published by: Abhi on Mar 12, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

04/29/2015

pdf

text

original

 
WPF Tutorial : Layout-Panels-Containers &Layout Transformation
By
| 28 Dec 2010 |Unedited contribution C#.NETDevWPFIntermediate This article describes the basics of WPF application, how you can deal with layout, placements of controls and position.4.98 (32 votes)12345
Table of Contents
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
Introduction
 
In my previous article I have discussed few basics of WPF applications, its architecture andinternal structure to start with WPF. In this article of the series, I am going to discuss about thevery basics of writing your first WPF application and how you can place controls in your window.This is very basic to anybody who wants to start with WPF. I will discuss most of them which arecommonly used.
A Window
While building your application, the first thing you notice is a Window. Window is the main classthat interact with the user and produces the lifetime of windows and dialog boxes. Like in normalwindows application, it produces the object windows using the normal API. A window has twosections.
1.
Non-Client Area :
which displays the outer boundary of the window, that we normally seewith any windows. The main parts of them are Icon, System Menu, a title Bar and Border.
2.
Client part :
This is the main part where the WPF controls will appear. You can customizethis area using WPF.
Type of Window
WPF window is of 3 types.
1.
Window
: This is basically a normal windowed application, where every controls are placedwithin the same window. The window appears normally as I told you earlier. The Clientarea are fully customizable using XAML.
2.
NavigationWindow
: This is a special type of window which is inherited from Windows but with a Navigation panel top of it. So if you want to create an application that makessense when used as Wizards, you might better go with
NavigationWindow
. You can alsocustomize the navigation panel yourself so that it goes with your own look and feel.
3.
Page
: Almost similar to
NavigationWindow
, the main difference is that, Page can beopened in Web Browser as XBAP applications.
 
In the above image you can see how Normal Window differs from NavigationWindow. NavigationWindow is very uncommon in general case, but might come handy when you needspecial treatment for your application.Let me discuss a bit on how you can use Pages in your application.Pages are created to be used as a Page for the Same
Window
. Navigating from one page to another is very simple. Page Class exposes an object of NavigationService which you can use to navigate between pages.
NavigationService
has few events like
Navigating
,
NavigationFailed
, NavigationProgress,
NavigationStopped
etc which you can use to show progressbar while the page is navigating. Methods like
GoBack
,
GoForward
and
Navigate
are the best way to navigatefrom one page to another.
private void Button_Click(object sender, RoutedEventArgs e){this.NavigationService.Navigate(new Uri("Page2.xaml", UriKind.Relative));}
Thus you can see, rather than calling a new window for Page2.xaml, I just used NavigationServiceto navigate from one page to another.For further reference you can use MSDN Article :OverView of Navigation[^]
Types of Containers
WPF Window is derived from ContentControl. Basically while working with Controls, you mightcome across a few types of controls which forms the basis for any WPF control. A ContentControlholds any arbitrary content. It may be a string, an object of any type or even an UIElement like

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->