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!
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'm having an issue with ListView in XAML.
I try to achieve a ExpandableList with opening animation. For this I wanted to use a ListView and StackLayout.
In the ItemSelected event, I would like to add values to the stacklayout and then increase the Height animated. But how do I get a reference to the ViewCell?
And further, is there a way to get the calculated height of the stacklayout and use LayoutTo to this value?
It might be easier to put an IsSelected property on whatever class makes up the ItemsSource of your ListView and set its value to true in your ItemSelected handler. Then you can subclass ViewCell and respond to changes in IsSelected in that class. Then put an instance of your ViewCell subclass in your ListView's ItemTemplate.
The main advantage of this approach is better encapsulation -- instead of modifying a ViewCell from your ListView, your ViewCell will be updating itself. It also insulates you somewhat from having to know the internal workings of the ListView.
Check out chapter 19 of Charles Petzold's book (PDF) for lots of useful information about working with ListViews and ViewCells.
I have an ItemsControl object and am setting the DataTemplate to hold a Grid with a couple controls in it. The controls are databoud to a collection of some object MyObj, specifically a TextBlock and a ComboBox. MyObj has its own collection inside of it for a property. If that property has only 1 object in its collection, only the TextBlock is visible. But if there is more than 1 object in the collection, the TextBlock is visible and the ComboBox becomes visible once the TextBlock is clicked on.
I have the ComboBox filled up with what it needs, I just can't figure out how to specify which ComboBox needs to become visible when the TextBlock is Clicked on.
I guess my question is, how would I even go about doing this? Or, is there a better way to think about this problem?
I'm new to databinding in Silverlight and running into a bunch of issues on my own. Any help is always appreciated. Thank in advance.
One thing that you could do is add an extra property to the data item that you binding to, something like 'IsSelectionAvailable'. Make the visibility of your combobox bound to this property (via a boolean to Visibility enum Value Converter). Finally, add a click event handler for the text box that sets the IsSelectionAvailable property to true for the object it is bound to.
Hope that helps.
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...)