I have a list view, with an itemtemplate, datatemplate, viewcell etc. In there I have a bunch of controls binding to the item properties. That all works great, but I do not seem to be able to reference another element on the same page within it, for example,
{Binding Path=MyProperty, Source={Reference AnotherElement}}
Even though I have another element on the same page called 'AnotherElement' that exposes 'MyProperty' and this exact binding works in other areas on the same page, I cannot get any bindings to refer to another element from within the listview itemtemplate.
Any ideas what I'm doing wrong?
Since you are in a listview item template the Xamarin Forms ListView needs a binding context to map the binding with by that i mean it needs the reference of the Source of its binding context you can provide that using the ListViews x:Name property
Give your list view a name:
<ListView x:Name="myList"...>
Then use its binding context as Source
Path=BindingContext.MyProperty, Source={x:Reference myList}}"/>
Related
I would like to create a simple wizard based on a TabControl in Avalonia UI with four pages. Each page with a few controls. Instead of the TabItem headers I would like to create my own buttons and hide the default TabItem headers.
There are plenty of solutions for WPF, mostly involving ItemsContainerStyle and the Visibility property, both of which don't seem to be accessible in the Avalonia TabControle.
Is there any way to hide the headers?
Or is there a better way to implement a wizard?
You probably need to use the Carousel class directly. It's used by the TabControl internally for presenting the current item.
See example usage here:
https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/CarouselPage.xaml - markup
https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/CarouselPage.xaml.cs - codebehind
When I use a Button control in DataTemplate for ListView (UWP app), Drag-and-Drop of ListView items doesn't work. If I use containers like StackPanel, RelativePanel or Grid, instead of Button control, everything works fine. I would prefer the Button control as a container, because I like its mouse Hover effect on ListView items. I can do something similar for StackPanel, etc, with a custom hover effect by using a combination of Style and Behavior programming but trying to avoid this route (too involved).
Can I do something to the Button control so that it gives me the hover and also responds to the Drag-and-Drop event when part of a ListView DataTemplate?
I am also curious what specifically makes the Button suppress the Drag-and-Drop of ListView items.
The Button is capturing the pointer which cause the pointer click event not be bubble up to the ListViewItem which cause the Drag&Drop to start.
You can take a look at ReleasePointerCapture method which will release the pointer capture allowing other item to capture it.
You will need to create a new class which extends the default Button class and override for example the OnPointerPressed method to choose the logic between the drag&drop and the click on the button.
Using a Xamarin Forms ListView with a custom ViewCell, is it possible to have a list item expand based on an event? Please ignore the orange lines, but reference the below picture...
Regular cell not expanded
User has tapped the triple dots causing the ViewCell to expand to show additional content
Is this possible? What is the technique to make that work?
You can have containers or elements inside your viewcell whose Visibility can be controlled based on the click. You will have to re render the elements once its expanded or collapsed for the viewcell to resize. Or else you will have the Viewcell being the size it was initially rendered, but the contents inside it overflowing.
Check out the following links :
How to implement Expandable/Collapsible ListView in xamarin forms?
CollapseListView-in-xamarin.forms
ExpandableListView
I'm trying to style the ComboBox control in XAML but haven't managed to style the colors in the dropdown/popup. The ComboBox seem to contain a ScrollViewer so I'm trying to style that. The items in the ScrollViewer is generated using a ContentTemplate and I guess I need to style it somehow.
Check this default system brush. You can customize these colors by adding below line in resource dictionary.
<SolidColorBrush x:Key="ComboBoxArrowForegroundThemeBrush" Color="MY_COLOR_HEX_CODE"/>
I'd like to know, how I can implement my own SemanticZoom WITHOUT GridView control.
I have my own custom controls on the mainpage but a structure similar to a grouped GridView and I want to open details after the user makes a zoom-gesture on a group.
But it seems that the SemanticZoom control only works together with the GridView.
Any ideas?
cheers, Thomas
The controls contained inside the SemanticZoom control can be any control that implements the ISemanticZoomInformation interface - ISemanticZoomInformation interface
Simple example at Semantic Zoom only supports GridView and ListView?