I want to have a control similar to this? Is there a way to do this using WPF.
Sample Image:
It is like a combobox but its comboboxitems works as menuitems. The menu item selected would be displayed in the combobox.
If you need menu item then use menu item. I think it would be much harder to customize combobox.
Related
I was wondering, is it possible to display a grid in a comboBox as its selectedValue (or displayMemberPath) ?
I wanted to do something like that :
It's a screen from Telerik's comboBox, but I wish to do the same in WPF only. I already use a grid inside the dropdown and it works pretty well, and I'd achieve something cool if I could display many rows as a selectedValue. I supposed I'd use a grid but applying a grid in the displayMemberPath style doesn't really work.
My comboBox is inside a DataGridTemplateColumn but I don't think it matters, just saying.
Thanks !
When I create a TreeView Control, insert several items, then I use TVM_SELECTITEM to select an default item. But this item is not highlighted by blue color. Later, if I use mouse or keyboard to select an item, it will be highlighted.
So how to make the default item being highlighted?
This is the function and parameters I used:
SendMessage(hTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem);
I just found I just need to set focus on TreeView control and it works.
But how do I have a gray highlight on the item even when TreeView lose the focus, when users select some options, like the following picture:
Since you figured out the answer to your original question, I'll answer your second:
I just found I just need to set focus on TreeView control and it
works.
But how do I have a gray highlight on the item even when TreeView lose
the focus, when users select some options, like the following picture:
Give your TreeView control the TVS_SHOWSELALWAYS window style. (Incidentally, the screenshot you show uses a ListView control, not a TreeView control. ListView controls have an equivalent LVS_SHOWSELALWAYS style.)
Is there a way to create a "header row" for a winforms combo box?
So that's it's always displayed at the top?
The quick answer is: probably not. You would have to make your own usercontrol to do something like that.
This Getting ComboBox to show a TreeView shows how to so something like that. Just replace the treeview with a usercontrol that contains a label at the top and a listbox. Pass your combobox list of items to the usercontrol, etc.
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 have a ComboBox with a DataTemplate. The DataTemplate has two controls, each of which has a ToolTip attached to it. The list of items of the ComboBox has the tooltips as expected when you hover over each control. But the selected item area on top of the ComboBox does not display the tooltips, though the controls are rendered as expected. Is there a way to force the tooltips to be displayed?
If you're using Mole or something similar, make sure that your control with the attached ToolTIp has IsHitTestVisible="True". Otherwise, the control is not listening for mouse events and will not recognize that the ToolTip should be shown in the first place.
You may also want to look at binding the ToolTip of the selected item to the ContentPresenter in the ComboBox since, after selection, your SelectedItem becomes the content of the ComboBox. You may need to override the ComboBox template and make sure the ContentPresenter can accept mouse input in order to force your ToolTip's visibility.