May 2nd, 2009, 05:43 AM
Adding a NumericUpDown instance to a Canvas instance
I need to create a dynamic dialog box using System.Windows.Window class where the controls being displayed inside this dialog will change at runtime. Therefore I am using a System.Windows.Controls.Canvas instance and then adding controls to the Children property of the Canvas instance.
However I need a System.Windows.Forms.NumericUpDown instance in the dialog box but I cant add it to the Children property of the Canvas instance as the System.Windows.Forms.NumericUpDown class is not inherited from the System.Windows.UIElement class.
Does anybody have any idea how the System.Windows.Forms.NumericUpDown instance can be added to the Children property of the System.Windows.Controls.Canvas class?
Or is there a class, that is similar to the System.Windows.Forms.NumericUpDown class, which is inherited from the System.Windows.UIElement class?
May 7th, 2009, 12:31 PM
Re: Adding a NumericUpDown instance to a Canvas instance
You basically have two options: Either use interop for embedding an existing WinForms control like NumericUpDown into a WPF app (discouraged, complicated, tedious, unelegant), or simply reproduce the control as a WPF control... Either roll your own, or take a look at this: http://msdn.microsoft.com/en-us/library/ms771573.aspx
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!