is it possible to create a combobox in wpf from code, which I could position wherever I want on the window?
In my case, I basically want to create something like a Autocomplete for DataGrid rows,...
Thanks!
TextBox supports auto complete, and you can create your datagrid's template column and you can specify the template with textbox which can interact and give you autocompletion.
if you put it in a <Popup> you can then position the popup wherever you want--it is not "bound" by a parent container.
Related
I want to change the display behavior of the selected item(s) in a WPF Listview. Specifically, I want to retain the custom textblock foreground colors that I've applied and apply a border around the item.
I am able to alter SystemColors.HighlightBrushKey and ControlBrushKey to change the background color of the selected item, but I don't know how to get it to stop changing the font color or use a border instead. I've tried manipulating the control template and have also searched Google for examples of how to do this, without success.
yeah, looks like you have to go through the pain of using ControlTemplates.
Good news is that via using Expression Blend, you can get current ControlTemplate for ListView and tweak the bit that you need and use that as your default ControlTemplate.
I have a style for a control and I'd like to add items to the context menu of that control. I was able to replace the context menu with my own but have found no way to add items to the existing one. Is this possible in XAML?
Thanks!
You can always toggle a MenuItem's visibility in XAML using bindings. This allows you to create one context menu but control the options displayed to the user entirely through XAML. This is what I've done in the past as it seems to be the easiest option.
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
Hey all, I've noticed that if I have a style setup for a treeview, and a different one setup for the treeviewitem, it gets overridden once I put the item in the tree. Does anyone have suggestions for how to control the style of each treeviewitem individually while mantaining a default style that is applied to the whole treeview? Basically I want to make the text of my treeviewitem red depending on a data field in the item. Otherwise I want it to be black. Thanks
DataTemplateSelector is not in Silverlight. Try below link
http://blog.timmykokke.com/archive/2009/09/28/datatemplateselector-in-silverlight.aspx
Thanks, turns out it was TreeViewItem.Style CAN be set to an ItemContainerStyle if you use the objects as references.
I have a design question:
If you had to make a WPF Combobox with search support,
(= combobox that shows a popup with some Buttons, Search TextBox, List.. etc
the selected item feed to the default's ComboBox TextBox.)
What would you do?
Write a custom control (diretly inheriting from System.Windows.Control)
Write a custom control inheritnig from Selector / ComboBox
Make a UserControl
Use a default ComboBox with a 'special Template' (CotnrolTemplate/Style ?) extended to search functionality
Use a default ComboBox with style and attached EventHandlers..
Thank you guys !
I have done that, and the method i used was option 2 - i did a template control inheriting from a third party combo, and replaced the popup contents with my own template.