Are there any APIs in Windows to turn a password textbox into something like this:
So that users will be able to reveal the password for a second while pressing the eye icon right next to textbox. Do you know any P/Invoke like API exists that I can call from my WinForms app?
No need for an API for that, you just toggle it yourself:
textBox1.PasswordChar = textBox1.PasswordChar == '\0' ? '*' : '\0';
For placing a button inside a textbox, see Button inside a winforms textbox
Related
Scenario: I have one more more WPF applications opened. I cannot change the source code of these apps. My purpose is Whenever user clicks any control (button, combobox, textbox etc.) on these apps, I want to know which control / element is clicked, and log it. Simply obtaining the name of the element would be enough like so: "App1 - button3 is clicked." or "App2 - button1 is clicked". If possible, I want to achieve this for both Winforms and WPF apps, but WPF is more important.
Any way to do accomplish this in the background is OK.
I tried examining and using source codes of snoopwpf (Since it is able to detect the element under the mouse cursor by pressing CTRL+SHIFT), but I wasn't able to achieve my purpose. I could not get the elements in different AppDomains. (AppDomainHelper.GetAppDomains() also returns null)
I looked a little into pywinauto module, however couldn't find such a functionality.
I have an Excel-dna addin which creates a WPF window with a Textbox in it and show it.
When i call Window.Show() and type something into the Textbox, the keyboard input is redirected to the selected Excel-Cell instead of into the Textbox.
When i call Window.ShowDialog() it works as expected.
My goal is to have something like a tool window being able to react on changing cell selection in Excel (but also being able to type into Textboxes in that tool window).
I have a WPF Winform application. The form has a header on the top and a user control below. Once i am done entering values in the user control, i want to dismiss this user control and add another user control in that area. I will have 4 user controls in a sequence and I may have to move back to the previous user control or move forward.
Which is the better approach to achieve this in MVVM? To hide and view the user controls or dispose the user control.
Hide. Its simpler.
Also your description sounds remarkably like a wizard, so you might want to look at using a NavigationFrame as this would then allow you to "navigate" to the next set of controls once once set is complete.
P.S. Navigation frames can very easily be styled to completely remove the navigation bar UI, see http://winchrome.codeplex.com/ for some examples
I have a stackpanel holding a group of buttons in my WPF program. I set it up so that the user can drag and drop the buttons to re-order them. I would also like the user to be able to drag a button away somewhere to remove it from the stackpanel. This could mean that the user is dragging the button to a completely different window (like Windows Explorer or Google Chrome or the Desktop).
Is this possible? Can my code be notified when the user releases (drops) the button while the mouse is over another program?
It looks like I can check the value that is returned from DragDrop.DoDragDrop(...). I call it like this:
var result = DragDrop.DoDragDrop(this, this, DragDropEffects.Move);
It looks like if result == DragDropEffects.None, then the user dropped the button off the window.
I have an ActiveX control inside a WinForms user control. My WinForms app loves it!
Now, moving over to WPF, I use the user control in a WindowsFormsHost control. Works great..., but I want to treat this control as a single element so the user can neatly hit TAB over the existing WPF controls AND this user control NOT to 'go inside' it. i.e. just treat it as a single control like all the others.
I think what i need is the ability to trap the keys, and in the event handler simply move focus to the next control in the sequence, but I can't seem to trap any keyboard input. Ive tried the WPF PreviewKey.. events and the like, but once the tabbing gets to the control, it seems to stay inside it and WPF events are ignored.
I couldnt find anything on this in many WPF books and the net. Can anyone suggest a way ?
Thanks,
Jack.
Can't you create some sort of a filter by doing a preview mouse down on the panel or window (whatever is the parent of your controls), this way the panel will catch it before the user control and you should set e.handled to true, and if the user control raised the tab event, keep pushing the focus until you get another control. Preview and e.Handled=ture should solve the problem.