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.
Related
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
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?
I have a series of WrapPanels within a DockPanel. I want all but the top panel to be disabled at the beginning but all panels to be visible. As the user satisfies conditions in one panel I want to enable another panel. However, I can't figure out how I can bind the IsEnabled property of the WrapPanel (or if I need to the individual elements) to a boolean in my ViewModel. Any idea?
Update2: This works amazingingly! Adding a convention for IsEnabled to Caliburn.Micro
Update: Oops I lied. It keeps resetting all of my XAML by having an object of the same type in the ViewModel.
Just realized that I can just create an instance of what I am trying to >enable/disable in the ViewModel and from that access the IsEnabled property. Not >direct but works!
I'm trying to build a WPF control inheriting from Selector and I want to change the state of the control when one of its items are selected in the design surface. Despite hooking on a debugger, I can't seem to capture any useful events from the control. I've managed to capture it being initialised and the wrappers for its child elements being initialised around the items of the selection, but I can't see any change of state, or event being triggered when the control is selected.
Importantly, I want to detect when the item is selected either by the user selecting the control in the design view or in the markup.
I'm trying to achieve a behaviour like that of the TabControl, where selecting a tab brings it to the front and exposes any content associated with the tab. I can't fathom how it works at design-time though.
What do I need to do to detect that a control is selected?
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.