3

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?

Agent007
  • 2,720
  • 3
  • 20
  • 24
Rocky
  • 4,454
  • 14
  • 64
  • 119

1 Answers1

5

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.

Pranay Rana
  • 175,020
  • 35
  • 237
  • 263