Dialog that can be use in winform and wpf - c#

Good day.
I created a dll. In this library i need to embed a dialog(which shows some values on textbox) which can run on windows form and wpf . i use winform in my dll but the problem is i can't show the dialog in wpf. i can't use Messagebox because i have a multiline textbox for user input.
Here is the screenshot of my dialog
Thank you.

you can use WindowsFormsHost, here is a doc tell you how to use this:
Hosting a Windows Forms Control in WPF

Related

How to find button handle in a WPF application, and click it programatically?

I'm trying to programmaticly (from my own application) press a button that is located on another running windows (WPF) application.
Todo so, a handle to the button would be needed. There are plenty of posts about how to get such a handle.
However, it seem that WPF applications don't present handles for their graphical components:
https://www.experts-exchange.com/questions/25665615/Spy-or-Windows-Api-Functions-not-locating-controls-on-child-window.html
Any clues on how to achieve an automated press on a button in such an application?
I don't have control of the source code for the application with the button.
I believe you'll need to look into UI Automation https://learn.microsoft.com/en-us/dotnet/framework/ui-automation/ui-automation-overview

invoking Windows 8 charmbar from wpf

How can one invoke Windows 8 charmbar from a wpf application.
I know this can be done by simulating the key stroke such as win + c from application but the problem is the the same combination is used to hide the charmbar.
I have a wpf application that has a button named show charmbar but the problem is if the same button is clicked when already the charmbar is open it acts as a guide charmbar .
Or else could some body guide me on how tho get the visibility of charmbar. Such as at a given moment is the charmbar visible or not.
The truth is a charmbar cannot be opened programatically in metro app development
for metro you can access various charms menu like settings share.
Here's a full sample for that
metro charms
But for c# wpf app
Heres a SO answer and I guess it works :)
open charms c#
take a look. :)

C# Windows Forms and XAML

I would like to know if it is possible to combine XAML with Window Form or reverse. Also I would like to know a good place to learn how to work with both of them.
For example I want to make a XAML window on which I want to add a button with an event action wrote in C#.
Yes this is possible (both ways)
WinForms in WPF
WPF in WinForms
In both cases you add a special control that acts as a host for the other environment.
WindowsFormsHost allows you to host a Windows Forms control on a WPF page.

Embedding a Windows Form into a WPF application

I have a Old windows form application and i don't want to convert it to wpf , i want to embed it inside my wpf application main window . How can i do this ?.
Also , How Can i transfer text between wpf and embeded WinForm using WindowsFormHost ?
You'll want to use a WindowsFormsHost. Check this tutorial out (shows how to do WPF in WinForms and vice versa).
You can use the WindowsFormsHost to add single Forms into an WPF application. If this is enough for your purposes have a look at this walkthrough.

click on a button in another application from my C# application?

I want to click on a button in another application from my C# application ,
and I don't have the source code for the application that contains the button
let us say as an example ...can I use windows calculator from my application by clicking its buttons Programmatically
I am using c# and .NET
I think I must use windows api to do this
does anybody have any idea????
Yes, it's not too complicated. You can use FindWindowEx to get the window handle, then iterate through the windows elements and use sendmessage or postmessage to send the WM_Click message.
Here's a codeproject project that does exactly what you want.
Code project

Categories

Resources