Can I somehow disable access by TAB on come controls on form in WinForms
(controls like textboxes must be enabled for access and writing but when user hits TAB it will access only buttons)
Set the TabStop property of the control to false.
You can set TabStop=false for individual controls.
Find the Tab Stop property on the the Other tab of the property sheet and set it to No for each TextBox you want to prevent the users from tabbing to.
Related
I have an UI who have a lot of object. I want my tab to circle between some object.
With
KeyboardNavigation.TabIndex="0"
But i don't want to stop on some object without TabIndex.
I know i can use
TabStop="False"
But i have a LOT of objects with children who are user control... Is their a way to say to WPF to only tab stop on item who have a tabindex for a user control?
Is their a way to say to WPF to only tab stop on item who have a tabindex for a user control?
No, because KeyboardNavigation.TabIndex is an attached property that has a default value of Int32.MaxValue unless you set it to something else for a specific element.
So there is no "only items who have a tabindex". You'll have to set the TabStop property to false for all items that you don't want to receive focus using the TAB key.
I am currently working on a project which has a tab control which contains a Wrap panel which contain a series of user controls. I am looking for a way to allow the user to select one user control and maximize it to the size of the tab control/window.
One thought is to simply remove all the other items from the panel.However I am attempting to use MVVM as much as possible and I'm not sure how much the user control should know about the panel. (The user control will contain a button to allow maximizing)
Is there a way to temporarily remove the usercontrol from the grid and treat it like a modal popup or just to fill the window?
How about having "Visible" or "Maximized" bool properties in the view model for each user control based item, and databind said user controls Visibility property to the appropriate property. Then bind your user controls maximize/restore button to command in the view model to change the VM properties appropriately?
I have a WPF app that uses different instances of a User Control; when the user clicks a button on the main window I need to set the focus on the textbox inside the currently active instance of the user control.
Which is the best way to set the focus on that child item?
child.Focus();
or
VisualTreeHelper.GetChild(parent, 0).Focus(); // you might want to test it for nulls
My WPF combobox is populated with a different set of strings each click of a button. There are other controls on the window as well. The combobox is the 'first' (top) in the window, but the text doesn't get highlighted. When the user tabs through the controls, the text DOES get highlighted, but when it's the first on the window, it doesn't.
Maybe i need to force a highlight on the individual textbox control 'within' the combobox itself, but how would i do this? I couldnt seem to find the internal 'structure' of this control anywhere. Could anyone help here?
Jack
to get the TextBox of Combobox you can use
TextBox TxtBox = (TextBox)myCombo.Template.FindName("PART_EditableTextBox", myCombo);
I'm not sure it's the best solution, but you can use FrameworkElement.FindName to access the child control -- it's guaranteed to be present in a combobox, because it's a key constituent part of the control.
That stated, is it not better to try and call .Focus() on the control? That is likely why when you tab, the highlight is provided.
Another option is to derive from ComboBox, and expose the child text box as a property allowing you to set it's selection, or add a method directly to the combobox to set it for you.
My WPF application consists of a main window with a tab control which has a series of tab items, each hosting a user control.
I'd like one of the user controls to be able to trigger the application to change focus from the current tab to a different one.
Is there a way for the user control to trigger its tab control container to change to another tab item?
The WPF system provides the RoutedEvent. This special kind of event can be created to be catched by every element in the tree. With this way you can fire the event inside your user control, and catch it in the TabControl that will do everything you need. The tab control can catch the event cause of it lies in the element's tree of your window.
You can start from here:
http://msdn.microsoft.com/en-us/library/ms742806.aspx
You'll need a Bubble Event.
Hope this helps.
You can have a property that binds with SelectedItem property of TabControl.