Focus on next userControl - c#

I have a user control that have a number of textboxes and comboboxes contained in it. These user controls are programmatically created and placed on a form. The final user of this application want the ability to press enter an instead of going to the next child control in the usercontrol, they want to go to the equivilent textbox in the next usercontrol.
So essentially i want "Enter" to take focus from usercontrol1.textbox1 and place it in usercontrol2.textbox1.

Related

Reaching Controls

So lets say I have a Panel. Inside of it there is a Button and TextBox. I can reach those controls' control with panel.Controls[index] with this way.
I am trying to reach panel with reverse way. I mean lets say I click the textbox inside of panel. And the active control of form became the textbox. Is there any possible way to reach that panel with active control?
Panel -> Textbox instead of Active Control -> Panel
Thanks

Redo Undo for wpf user control at run time

i have wpf application, in my application on one editor user can add n number of user control and for each user control he can edit or enter properties, i want to add redo undo functionality for this editor,i.e. for add user control remove user control, move user control edit user control properties at run-time.
Run the program and type some text into the TextBox before clicking the two buttons. To see the way that multiple changes can be undone, type some text, click Undo and then Redo, then add extra text. It will now be possible to undo twice.

Select / Unselect user control

I am creating an application in which i have a user control that can be added by user dynamically any number of times. Form also contains some other controls.
Suppose he has added the control 10 times.
Requirement:
1) When the control is selected, it should be highlighted and when the
other control is selected then the previous control looses the glow.
2) User can select multiple controls at the same time. Now all the
selected controls should be highlighted and the selection has to be
made with ctrl key.
There is also a possibility of moving the controls on the form.
What I have achieved:
1) I am able to add multiple controls dynamically.
2) I can change the location of one control dynamically.
3) I am able to highlight the control when it is clicked, but not able
to un-glow it when user has clicked elsewhere. Need to know which event of User control can be used for that. -- Got the solution for this. On mouse click i made the focus on the control and then handle GotFocus and Lost Focus events to golw and un-glow the control.
Problem Left:
No success in selecting multiple controls and dragging them
simultaneously. If i would be able to select multiple controls then
dragging would not be very difficult.
If you are talking about buttons, unfortunately you cant select multiple at a time..

move into next field webbrowser control

I am using a web browser control in wpf to load a web page. I need to have a wpf button which when clicked will help the user to move next input field, The web page have two text box and two radio buttons as input fields. How can i simulate this when the wpf button is clicked?
To set focus on a WPF textbox you can do as following. (Possible duplicate : source)
To set logical focus to an input control
FocusManager.SetFocusedElement(this, textboxJack); // set logical focus
To set keyboard focus to an input control
Keyboard.Focus(textboxJill); // set keyboard focus

Repeat a user control as user clicks next?

I have a user control that consists of some textboxes and checkboxes. Once the user is finished filling the first one, they should be able to add one more form by clicking an "add another record" link button.
How can I repeat this usercontrol as the user clicks?
I am supposed to use C# only.
So, we are talking of UserControl where your fields are located (I mean, that this is a one class inherited from UserControl or Control. )
There are a lot of ways to do it. But, I think, to be mode 'code concise' is to use FlowLayoutPanel
a) Create this panel. (through visual designer i.e.)
b) When user clicks, create your control
c) add your control to layout panel.
var myControl = new MyControlWithForm();
flowLayoutPanel1.Controls.Add(myControl);
One could use flowLayoutPanel1.Controls array to process all filled forms afterwards.

Categories

Resources