C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » Visual Studio »

WPF Basics Part-1


Posted Date: 04 Jan 2009    Resource Type: Articles    Category: Visual Studio
Author: Avinash MohanMember Level: Gold    
Rating: 1 out of 5Points: 3



WPF Fundamentals

WPF has some important new concepts that are beyond of what most .NET developers know from WinForms. But its very useful to understand these concepts before you start developing WPF applications.
XAML

XAML stands for Extensible Application Markup Language. Its a simple language based on XML that was invented for WPF to create and initialize user interface elements. The idea is similar to HTML.


Logical and Visual Tree
User interface elements in WPF have a hierachical relation. This is called the visual tree. A user interface element is composed of multiple parts. If you build a tree including all controls parts you have the logical tree.


Layouts:-
StackPanel
The StackPanel is a simple and useful layout panel. It stacks its child elements below or beside each other, dependening on its orientation. This is very useful to create any kinds of lists. All WPF ItemsControls like ComboBox, ListBox or Menu use a StackPanel as their internal layout panel.


Code:-

How do you like your coffee?






Stack Items horizontally
A good example for a horizontal stack panel are the "OK" and "Cancel" buttons of a dialog window. Because the size of the text can change if the user changes the font-size or switches the language we should avoid fixed sized buttons. The stack panel aligns the two buttons depending on their desired size. If they need more space they will get it automatically. Never mess again with too small or too large buttons.
Code:-





WPF Grid Layout Panel
The grid layout panel is the most powerful layout panel in WPF because its so flexible and universal in use. Thats the reason why Visual Studio adds a Grid layout control as root element by default to each Window or Page.
The grid layout defines a set of columns and rows. Each side of a control that has been added to the grid layout can now be bound to one of the row or colum with an optional margin.
Code:-




















Sizing rows and columns
The size of a row or a column can be defined in the following types
• Fixed size of logical units (wpf pixels)
• Auto takes as much space as needed by contained controls
• Star (*) takes as much space as possible, percentally split over all star columns. Like percentage in a HTML table except that the sum of all relative columns does not have to be 100



For more details, visit www.c-sharpcorner.com



Responses

Author: ChandraShekar Thota    26 Jan 2009Member Level: Diamond   Points : 2
Good

Chandrashekar Thota(Editor, MVP)


Author: Mohanakrishnan    14 Jul 2009Member Level: Gold   Points : 0
nice,
i need some sample for that

Mohanakrishnan


Author: Prasad     29 Oct 2009Member Level: Bronze   Points : 0
it was really nice but can you get little more sample on this


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
WPF  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: ASP.NET 2.0 Keyboard ShortCut
Previous Resource: How to Create javascript alerts in ASP.NET using UpdatePanel
Return to Discussion Resource Index
Post New Resource
Category: Visual Studio


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use