WPF datagrid control - wpf

what to do if data grid control was not available in WPF component visual studio 2008
i ll try to add control from wpf component but there are no data grid control available in the list.

If you are using WPF 3.5, you need to install WPF Toolkit to get DataGrid control.
However, with WPF 4.0, microsoft introduce DataGrid under System.Windows.Controls (PresentationFramework.dll) assembly so that it can be used just like other controls without referring to WPFToolkit.

Related

Canvas control is not available in Windows form application?

WPF Canvas control is not available in Windows form application. Am using Visual Studio 2010. Framework 4.0. Is there way to add these controls to VS2010 toolbox?
You can create a WPF Usercontrol containing the Canvas control and then host it in an ElementHost control in winforms. Details of how to do it here.
You can then add that final control to the toolbox. More details on how to do can be found on this answer.

How to generate xamlmarkup for properties of a custom control?

I am developing a custom control library using WPF in VS2010.It is a chart control like System.Windows.Controls.DataVisualization.Charting.Chart.
When the Chart Control provided by MS is dragged from the toolbox and dropped into the VS XAML designer , the xaml markup is generated for the Chart Control, along with the xaml markup for the property ‘Series’(‘Series’ is a content property) of Chart Control.
I was wondering how this is implemented .In another word, how can I generate xamlmarkup with attribute set for properties of a custom control when dragged from the toolbox and dropped into the xaml designer?
You may have to pull down the SDK but here are some links on MSDN to get started:
How to: Create a Toolbox Control That Uses WPF
Walkthrough: Creating a WPF Toolbox Control
Control Authoring Overview.

Winforms toolbox tools for WPF

I'm new to WPF and I'm wondering is there anyway to have elements from Winforms toolbox in WPF. I mean the Winforms toolbox has a lot of elements and they're not present in WPF toolbox. for example something like PerformanceCounter in Winforms toolbox is not found in WPF toolbox.
thanks in advance
There are some controls that didn't get represented in WPF, but you can use WindowsFormsHost. As the name indicates, it's purpose is to host the Windows Forms elements.
Walkthrough: Hosting a Windows Forms Control in WPF
I would add that things like PerformanceCounter you can use in code, rather than placing it on a form. Other elements which do have a UI purpose can be placed inside a WindowsFormsHost control. I do this with ReportViewer -- it's a Windows Forms control that has no WPF equivalent.

how to add a WPF dialog to a Winforms project

I am using Visual Studio 2008 targeting .net 3.5 framework. I need to add a WPF dialog to a Winforms project. I was thinking that by adding reference to PresentationCore, PresentationFramework and WindowsBase.dll and copying a WPF dialog from a test WPF project to the WinForms project in question should do the trick, but after that when I try to open in designer a WinForms dialog studio just crashes and closes.
So basically the question is how to add a WPF dialog to a WinForms project?
Thanks
Create the dialog as a WPF UserControl Library. Add it to the Windows Form application by using Project->Add Existing Item. Add an ElementHost component to the Windows Forms form. Set the HostedContent of the ElementHost to the WPF User Control.
This link may help you:
http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.aspx

How to bind a windows control in WPF?

I'm using WPF 4.0. I have a WPF Datagrid. One of my column in a datagrid is a template column. In that template column I have used Win forms Textbox and my problem is that,
How to bind that win forms texbox control in WPF?
How to access that control or column in Code behind (c#)?
You can't use WPF data binding with WinForms controls, WPF data binding requires dependency properties and FrameworkElement derived objects - both are part of WPF and not available in WinForms.
WinForms has it's own data binding system, it's completely incompatible with WPF's data binding (it's also weaker and unusable in some cases).
If you want to use WPF's databinding you have to use only WPF controls.
I suggest you either use the WPF TextBox or switch the entire grid to WinForms and use DataGridView.
by the way - I wouldn't put a WinForms control inside a WPF data grid (or any other items control) - I suspect this will give you a lot of trouble in the future.

Resources