in winForms, I have .Handle property, how do I get the equivalent to in WPF?
I tried using WindowInteropHelper but it does not suporte RichTextBox,only Window types.
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Controls in WPF do not have associated WinAPI handle, like WinForms control do. WPF uses only one WinAPI window to process window messages from OS and encapsulates it in Window class instance. The best you can do is to navigate through parents of your control until you find a Window and get the handle. As far as I understand this will likely be the same handle as one returned by WindowInteropHeler.
UPD.
To make this answer more useful and out-of-box’y here is some code (not tested though):