Usage

To use the WPF Window, first download the dll from the downloads section. Create a new WPF project in Visual Studio and add a reference to the downloaded VisualTools.Controls.dll.

To create a WPF Window in XAML, first add a new window control to your project (right click project -> Add -> Window). The XAML markup for the new window should look something like this:

 

<Window x:Class="TestApplication.MyWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MyWindow" Height="300" Width="300">
    <Grid>
        
    </Grid>
</Window>

Now, add the following line (in bold) to reference the WPF Window library:

<Window x:Class="TestApplication.MyWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vt="clr-namespace:VisualTools.Controls;assembly=VisualTools.Controls"
        Title="MyWindow" Height="300" Width="300">
    <Grid>
        
    </Grid>
</Window>

Change the Window tag to vt:WpfWindow:

<vt:WpfWindow x:Class="TestApplication.MyWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vt="clr-namespace:VisualTools.Controls;assembly=VisualTools.Controls"
        Title="MyWindow" Height="300" Width="300">
    <Grid>
        
    </Grid>
</vt:WpfWindow>

You also have to change the code a bit from:

    public partial class MyWindow : Window
    {
        public MyWindow()
        {
            InitializeComponent();
        }
    }

To:

    public partial class MyWindow
    {
        public MyWindow()
        {
            InitializeComponent();
        }
    }

Just change the StartupUri in App.xaml to point to MyWindow.xaml and run the project.  You should have a basic WPF Window.

Last edited Nov 11, 2010 at 3:23 PM by tjscience, version 3

Comments

No comments yet.