Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

WPF Tutorial : Layout-Panels-Containers & Layout Transformation

, 21 Aug 2011
This article describes the basics of WPF application, how you can deal with layout, placements of controls and position.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace LayoutDemo
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();            
        }

        private void Grid_Click(object sender, RoutedEventArgs e)
        {
            wndGrid gd = new wndGrid();
            gd.ShowDialog();
        }

        private void StackPanel_Click(object sender, RoutedEventArgs e)
        {
            wndStackPanel sp = new wndStackPanel();
            sp.ShowDialog();
        }
        private void WrapPanel_Click(object sender, RoutedEventArgs e)
        {
            wndWrapPanel wp = new wndWrapPanel();
            wp.ShowDialog();
        }
        private void DockPanel_Click(object sender, RoutedEventArgs e)
        {
            wndDockPanel wp = new wndDockPanel();
            wp.ShowDialog();
        }
        private void Virtualize_Click(object sender, RoutedEventArgs e)
        {
            wndVirtualize wp = new wndVirtualize();
            wp.ShowDialog();
        }
        private void Canvas_Click(object sender, RoutedEventArgs e)
        {
            wndCanvas wp = new wndCanvas();
            wp.ShowDialog();
        }

        private void UniformGrid_Click(object sender, RoutedEventArgs e)
        {
            wndUniformGrid ug = new wndUniformGrid();
            ug.ShowDialog();
        }
        private void ScrollViewer_Click(object sender, RoutedEventArgs e)
        {
            wndScrollViewer ug = new wndScrollViewer();
            ug.ShowDialog();
        }
        private void GroupBox_Click(object sender, RoutedEventArgs e)
        {
            wndGroupBox ug = new wndGroupBox();
            ug.ShowDialog();
        }
        private void Expander_Click(object sender, RoutedEventArgs e)
        {
            wndExpander ug = new wndExpander();
            ug.ShowDialog();
        }
        private void ViewBox_click(object sender, RoutedEventArgs e)
        {
            wndViewBox ug = new wndViewBox();
            ug.ShowDialog();
        }
        private void Popup_Click(object sender, RoutedEventArgs e)
        {
            wndPopup ug = new wndPopup();
            ug.ShowDialog();
        }
        private void InkCanvas_Click(object sender, RoutedEventArgs e)
        {
            wndInkCanvas ug = new wndInkCanvas();
            ug.ShowDialog();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Abhishek Sur
Architect
India India
Did you like his post?
 
Oh, lets go a bit further to know him better.
Visit his Website : www.abhisheksur.com to know more about Abhishek.
 
Abhishek also authored a book on .NET 4.5 Features and recommends you to read it, you will learn a lot from it.
http://bit.ly/EXPERTCookBook
 
Basically he is from India, who loves to explore the .NET world. He loves to code and in his leisure you always find him talking about technical stuffs.
 
Presently he is working in WPF, a new foundation to UI development, but mostly he likes to work on architecture and business classes. ASP.NET is one of his strength as well.
Have any problem? Write to him in his Forum.
 
You can also mail him directly to abhi2434@yahoo.com
 
Want a Coder like him for your project?
Drop him a mail to contact@abhisheksur.com
 
Visit His Blog

Dotnet Tricks and Tips



Dont forget to vote or share your comments about his Writing
Follow on   Twitter   Google+

| Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 22 Aug 2011
Article Copyright 2010 by Abhishek Sur
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid