Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

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?

like image 299
Rocky Avatar asked Dec 08 '25 21:12

Rocky


1 Answers

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.

like image 123
Pranay Rana Avatar answered Dec 10 '25 12:12

Pranay Rana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!