This is fun+cool, daddy-o.
Start experimenting WPF on XP:
0) Download the .NET 3.0 RC1 and SDK and install them. Get them from here:
http://msdn.microsoft.com/windowsvista/downloads/products/getthebeta/
1) Add these References to projects you want to host WPF controls:
PreesentationCore
PresentationFramework
WindowsBase
WindowsFormsIntegration
2) Add these using statements to your Form:
using System.Windows.Forms.Integration;
using System.Windows.Controls;
3) To avoid ambiguity, explicitly state namespaces for controls like 'Button' and 'ListBox':
System.Windows.Forms.Button // .NET 2.0
System.Windows.Controls.Button // .NET 3.0
4) Place two Panels on your Form from the ToolBox.
5) Put this code in your Form's OnLoad event:
ElementHost hostListBox =
new ElementHost();
System.Windows.Controls.ListBox wpfListBox =
new System.Windows.Controls.ListBox();
for (int i = 0; i < 10; i++)
wpfListBox.Items.Add("Item " + i.ToString());
hostListBox.Dock = DockStyle.Fill;
hostListBox.Child = wpfListBox;
ElementHost hostButton = new
ElementHost();
System.Windows.Controls.Button wpfButton =
new System.Windows.Controls.Button();
wpfButton.Content = "Avalon Button";
hostButton.Dock = DockStyle.Fill;
hostButton.Child = wpfButton;
this.panel1.Controls.Add(hostListBox);
this.panel2.Controls.Add(hostButton);
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.