Rocky
Rocky

Reputation: 4524

how to typecast System.Windows.Controls to System.Windows.Forms wpf

I am trying to TypeCast Windows.Controls to Windows.Form but getting Null.

private void treeView_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{       
  var tv = sender as System.Windows.Forms.TreeView;
}

can I TypeCast System.Windows.Controls to System.Windows.Forms if yes then how?

Upvotes: 3

Views: 926

Answers (1)

Pranay Rana
Pranay Rana

Reputation: 176896

According to MSDN

windows.controls- The System.Windows namespaces contain types used in Windows Presentation Foundation (WPF) applications, including animation clients, user interface controls, data binding, and type conversion. System.Windows.Forms and its child namespaces are used for developing Windows Forms applications.

System.Windows.Forms - The System.Windows.Forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system.

So what you actually want is not possible at all.

Upvotes: 5

Related Questions