I have my own ContextMenu. I want to know that how can I disable Default Column Popup Menu for DevExpress XtraGrid control and show my own ContextMenu when user right-clicks on specified Column?
Check my answer to a similar question: How to add to the GRidViewColumnMenu Color und Font Editors
All you need to change is clearing the default Items collection, and instead of adding a new DXEditMenuItem, add one of these: DXMenuItem, DXCheckItem, etc., use which you need. But the idea is quite the same.
Related
I'm trying to create a button in main window that would look like a globe, which would allow user to select his/her location. I want it to display a listBox when clicked on it just below the button itself.
Any hints on how to do this?
Probably the simplest way to do this is restyle a ComboBox and then restyle the ToggleButton in the ComboBox and remove the editable textbox.
This will avoid you having the implement the functions of the ComboBox for your popup.
Try using this as a starting point.
Another Approach would be to use the Expander Control with a list box in it
Link
OR
You could play with the Listbox's visibility property
I am asking for a programming approach.
This is my problem:
I have a WPF window, with a ComboBox at the top.
When user select the item in combobox, depends on the selection, the Grid below it will show a corresponding element, for example: if use choose Display from combobox, then the element in Grid will change to a ListView; and when user choose Add from combobox, the element in Grid will change to a form(textboxes).
Should I create several Grid, collapse them, and show them only when user make selection? Or any other more brilliant ideas?
Thanks.
Put a UserControl in the cell, and set its Content according to the control selected in the ComboBox.
There can be two ways:
You add one panel containing the controls required for each of the items in the combobox. You can hide all of them and on SelectedIndexChanged, you can show the appropriate panel. This will need more memory, but the implementation is simpler.
The other way will be to have a single panel and render the controls in run time on SelectedIndexChanged. This will need less memory, but will be complex to implement. Also rendering on run time might need some additional time (so the throughput).
What you can do is place a Panel(Like Grid, DockPanel) below the combobox and based on it's selection, dynamically add/remove controls in the panel.
For ex: If the user selects Display, then, remove all the child elements of the Panel and add a GridView.If Add is selected, remove all child elements and add a TextBox.
After adding, attach an event handler in code behind to perform the action you would want to perform.
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.
If I have a ListView embedded in a WinForm, is there any way I can simply click in the ListView and start typing in new items when the form is running?
At runtime, no. The only edit option it has is the LabelEdit property. Set it to true to allow the user to edit the ListViewItem.Text property of existing items.
In visual studio when you click on the listview a small triangle in the top right appears. When you click on it you can edit columns, etc.
I want to create a combobox with some style. I dont want old dropdown what we are getting. I want some new dropdown which looks very nice. Is there any way to create a dropdown like that.
Plz give me suggestions
Check this link out on msdn. This is the actual control template for the combo box. You can copy and paste this into your application (within your app's Resources).
Create a form and slap a combo box on it with some data in it. Then start changing the control template and view the results. Start off simply by changing colors and adding borders around elements to see what controls which part. Then you can start switching out larger parts of the template to match what you're looking for.
one can start with the standard combobox, and then use various controls and styles to change the look and feel of the control, and it's corresponding drop down.