I was wondering if I can have a ComboxBox with a Treeview as the selector rather than a list?
I note that there is a ComboBox.ItemsPanelTemplate, but I don't know what I need to do to get this to work?
I could build a control 'from the ground-up' with a separate TextBox, Button and TreeView in a PopUp control, but wondered if there is an easier way.
Lee
Are you just wanting the combobox for presentation purposes regarding the treeview?
Why not use a treeview as is and just trigger the display via visibility or animation from a button or control of some sort?
I am working on similar theme as we speak. I am using the Expander control from the Silverlight Toolkit with a TreeView control inside it. When an item is selected in the TreeView, it sets the Header of the Expander and then collapses the Expander.
Initial tests indicate it's OK but as I say, just started with it myself. Will let you know if I hit any stumbling blocks.
Related
I Have a WPF listbox and are using the GongSolutions.Wpf.DragDrop so the drag drop can be handled in the bound ViewModel.
My listbox is using an ItemTemplate, where each item is a UserControl that is basically just a panel with a TextBox.
When I try and select text within the text box, a drag operation starts. I would like to disable this drag operation just for this TextBox.
Would anyone know how to do this, and if particular when using the GongSolutions.Wpf.DragDrop library?
Thanks in advance
As it turns out, upgrading to the latest version fixed this.
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
Silverlight 4 has a new ContextMenu control in the latest toolkit.
I can't find any examples anywhere on how to reliably use this ContextMenu on a DataGrid row. Theres a tonne of context menus out there but I want to use the new version from the toolkit.
I'd like to be able to set context menus for rows as well as cells.
The only way I've found is to manually create the menu on right click and show it, but I'd like to do it in XAML.
Note: You need to currently use this workaround to avoid binding problems when using ContextMenu in XAML for a datagrid cell.
The developer of the Toolkit's ContextMenu wrote this article, specifically talking about using it with a DataGrid Delay's Blog
You can use this open source multi-level menu and context menu as alternative:
www.sl4popupmenu.codeplex.com
The demo on the main page shows how to do it in code. But you can also create the menu anywhere in your XAML like any other control and then associate it with the Datagrid using the RightClickElements property. The control will then handle everything else for you.
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.
Is there any way to virtualize tooltip in WPF? I have many dataitems displayed on map. When i'm changing template, for example, it takes a lot of time to generate UI for tooltips that are invisible. Maybe wpf supports something for such cind of virtualization?
Thanks in advance.
The way in which I've done this before is to generate a tooltip that is very simple, with a container item as the root and a simple single textblock inside, and then hook into the loaded event on the textblock, to detect when the tooltip is trying to be shown.
At that point, I then generate the full tooptip on the fly and replace the contents of the container, removing the textblock placeholder in the process.