How to get the focused control in Windows 8?
Now I am using OnLostFocus and OnGoFocus, using a variable to flag when the control has the focus. It works fine for a small number of controls, but I would need a general solution.
In Windows Forms, there is a function to get the focused control but I cannot find it in Windows 8.
Use FocusManager to get the currently focused control.
Related
I'm used to windows forms but I'm trying to get the hang of the universal apps. I need an alternative to FlowLayoutPanel from windows forms, I'm trying to make the stack panel work in similar way but it's there's one problem - if my items reach the border of the panel they wont get to the next line they will simply move out of the visible area and appear invisible. What can i do about this ?
You are looking for VariableSizedWrapGrid
I have a very simple scenario where I can focus an editable text box, the cursor appears inside the field, bt the keyboard will not show.
I have replicated this in a small sample app (Windows Phone 8.1 - Universal App). Very easy to recreate.
Create an 8.1 universal app. In the MainPage for phone add a text box and a button. The code for the button just sets the textbox to NOT read only. The default state of the textbox is ReadOnly.
Run app, select edit and then select the field. Cursor is present and keyboard opens. Close app.
Failure scenario:
Open app, touch read only text field. Note: No cursor is in box as it is read only.
Select Edit button. Tap the text field. Cursor is focused into field, but keyboard does not appear. I have a sample app with this behavior.
Any Resolutions?
This is a known issue in Windows Phone 8.1 which is fixed in current builds of Windows 10 Mobile.
Unfortunately I don't see any good workarounds for this on Windows Phone 8.1 other than "don't do that". Instead of switching a TextBox into and out of IsReadOnly mode try swapping between two TextBoxes (or a TextBox and a TextBlock).
Just started develop an application in c# using winforms metro ui and I can't figure out how to use a metroscrollbar with a metro textbox. If i go under properties when selecting the textbox i can choose scrollbar but it shows the normal Windows form..
Please see the picture down below:
How can I use the Metro scrollbar instead of the normal scrollbar?
I'm trying to get the ability to use the touch screen on a windows tablet in my application. All the examples I've seen use system.windows.Input and get touch points from a WPF canvas. My app is a winforms app and I don't have the time (deadline this week) to convert the app, so I thought to try the elementhost method, but I'm not sure how to go about this.
I've added an elementhost to my form, and then I wanted to create a canvas and add it...but it looks like the elementhost will only hold windows forms controls?!?
System.Windows.Controls.Canvas touchcanvas = new System.Windows.Controls.Canvas();
elementHost1.Controls.Add(touchcanvas);
It gives me an error on the controls.add because touchcanvas is not a valid windows forms control.
How can I add a WPF canvas to the elementhost and be able to raise it's events? such as touch events
I believe you need to use Child property of ElementHost.
elementHost1.Child = touchcanvas;
I am unable to figure out why I can use Spy++ to get handle, window class etc of some windows application. For example, iexplore.exe, it just doesn't work on url text box or any text, edit box area if any in the page loaded; there are also windows application I get only the outer layer's properties whereas its internal buttons, textbox or combox are inaccessible. In these applications what should I do to reach them ? Thank you :)
These programs use windowless controls.
Instead of using standard Windows controls, they draw and process everything themselves within one giant container.