Is it possible to show a custom control in the "collapsed part" of a WPF combobox? I mean the part above the popup when you click on the expand togglebutton.
There seems to be an "SelectionBoxItemTemplate" that defines the content when the combobox is collapsed, but that property is read-only. Is there a way to change that template, without overriding the whole combobox controltemplate?
Related
I have a Grid that handles Tap events via a trigger behavior. Inside this Grid are a Checkbox and a TextBlock, and I put multiple of these Grids is in a Listview as ListViewItems.
The Checkbox's IsChecked Binds to a boolean property. What I want to achieve is that the checkbox UI itself represents the current state of this property, but if I tap on the checkmark only the grid (the parent container) handles it.
To summarize, IsChecked should follow the property I specified in the ViewModel, but the checkbox should not react to any tap events in itself and leave that to its parent. (Since I use a command as a receiver I did not find a way to access the Tap Events arguments.)
I tried IsHitTestVisible, and it messes with the visual template, same as setting Disabled (since the checkbox should behave just as it would if it were enabled).
The control itself is a TreeView, basically making indents with margins in a Listview.
My style is defined for the listview.
Listview items will have focus behaviour.
I have 3 types in my ListView.
One is unselectable and will also not having focus behaviour (used property IsHitTestVisible = false)
One is selectable, can have focus colors (works correctly)
One should be selectable but only should not having a focus state.
IsEnabled changes the transparancy and is unselectable so no option.
IsHitTestVisible doesnt change the transparancy but make the item also unclickable.
Do anyone have an example how I can remove only the focus behaviour but keep the rest for a specific item?
You can create a ViewCellRenderer for your listview. For Reference you can use this link:
http://blog.wislon.io/posts/2017/04/11/xamforms-listview-selected-colour
I have a ListPicker (from Telerik's Rad Controls suite) in PopUp Mode (with around 200 elements) with its visibility set to Collapsed. I want to open when it when I press a button, instead of when I press the control itself.
Basically I'm asking if there's any way of programatically opening a UI element in Windows Phone (something like Control.Open() in the code behind).
The context for my question is the following:
as you know, the selected item of a list picker is displayed in the page containing the control.
users can click on this item to activate the control.
I want to display only one of the properties in the page containing the control (for example MyObject.Name instead of the entire MyObject), but I can't do this because the SelectedItem and ItemsSource need to be of the same type.
I'm thinking of styling a button to look identical to the ListPicker's selected item.
I need to open the ListPicker programatically when I click on the button, I'll bind the button's text to MyObject.Name
Alternatively, I could just do a data template for the way the list picker is displayed, but I'm not convinced it's possible.
Found the answer. It seems Telerik's List Picker allows you to set both an ItemTemplate for displaying items in the actual page, and a PopupItemTemplate for displaying items when the list is expanded. Both are Data Templates, so you can use Binding for values.
In my wpf window I want to change part of it (make different controls visible) when combo box selection is changed. Exactly like TabControl works, just with combobox. I know I could just make some controls visible while hiding the others in the c# code behind but I want to find out if there are other -better solutions.
You can use two Grid or GroupBox (or other container type) controls and put appropriate set of controls in each of them. This way you can just visibility of panels to hide the whole set of controls instead of hiding each control directly.
It may sometimes be appropriate to create a user control for each set of controls. However, this can depend on a specific case.
It appears that in a WPF TabControl the user can select multiple items, either via Ctrl-Click or Shift-Click.
Is there a property that controls this? Or do I have to handle the click/select event and explicitly unselect other items?
Thanks to Moore's comment, I was able to solve this.
Each TabItem in the TabControl.Items collection needs a control to display the content. My program is using a ListView:
tabItem.Content = new System.Windows.Controls.ListView();
When creating each ListView, set the SelectionMode property to Single.
(Why that isn't happening, if Single is the default, is a mystery...)