data-binding

After migration to androidX: Databinding problem (Android Studio 4)

独自空忆成欢 提交于 2021-01-29 10:32:19
问题 I migrated a project to androidx. I changed the xml-files by hand an I also set the imports manually, where Android Studio wasn't successful. When I try to rebuild the project, the following error occurs in the compiled file DataBinderMapperImpl.java The head of this file: package com.xxxx.todo; import android.util.SparseArray; import android.util.SparseIntArray; import android.view.View; import androidx.databinding.DataBinderMapper; import androidx.databinding.DataBindingComponent; import

How to bind the position value of Xamarin.forms.Maps inside the ListView?

人走茶凉 提交于 2021-01-29 06:50:28
问题 I am using Xamarin.forms.Maps for showing the map in my project. The map is inside the ListView and I need to bind the coordinate positions to the map. Model Class: public class History { public double Latitude { get; set; } public double Longitude { get; set; } } Data adding part: historyList.Add(new History() { Latitude= -28.854930 ,Longitude= 151.166023 }); historyList.Add(new History() { Latitude = -28.853671, Longitude = 151.165712 }); historyList.Add(new History() { Latitude = -28

How to use DataTemplateSelector on TreeViewItem's template?

不羁岁月 提交于 2021-01-29 06:10:10
问题 I have a TreeView with a custom resource dictionary for its TreeViewItems template. I need to be able to programatically change the template for each TreeViewItem based on its binding's value. As far as I can tell, I can't access the binding from the ResourceDictionary xaml. I think I need to extend the TreeView with my own userControl, but I'm not sure what I need to actually add to it to achieve what I want. Thanks in advance. <TreeView Name="dirTree" AlternationCount="2" Background="

Winforms data binding a control to an element of an array at specific index

自古美人都是妖i 提交于 2021-01-28 19:17:46
问题 I am attempting to create a databinding between a numericupdown and an array element. In my form I have tried creating the binding shown below, but it doesn't seem to work. Any help would be appreciated. Binding: nudTest.DataBindings.Add("Value", eac.ESettings.HsvArray[0], "", false,DataSourceUpdateMode.OnPropertyChanged); Array: public class ESettings : INotifyPropertyChanged { private int[] hsvArray = new int[6]; public event PropertyChangedEventHandler PropertyChanged; [XmlIgnore] public

Binding to a class property in a dictionary in wpf

对着背影说爱祢 提交于 2021-01-28 19:04:25
问题 If one binds to a listbox's ItemsSource to a list type structure such as an ObservableCollection (or any value-only container really) with the type of a class ( List< MyClass> ) one can access the properties of said class. But if one has a Dictionary<long, MyClass> and binds the itemssource to Dictionary.Values one can not access the class properties anymore. So basically this is my XAML <ListBox ItemsSource="{Binding bm.Values}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock

WPF TextBlock formatting bold from string property

让人想犯罪 __ 提交于 2021-01-28 11:44:22
问题 I have binded TextBlock text to a string property. Xaml look like: <TextBlock Text="{Binding Message}" TextWrapping="Wrap"/> Property on the ModelView class look like: private string message; public string Message { get { return message; } set { message = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Message))); } } I want to be able to use Textblock formatting abilities such as bold. for example: Message = "Some string with <Bold>bold</Bold> words"; On run time

Can you use a BindingAdapter on a ViewStub?

 ̄綄美尐妖づ 提交于 2021-01-28 08:08:37
问题 I want to create an "inflateWhen" BindingAdapter and attach it to a viewstub to have it inflate when a boolean value is true. However, the BindingAdapter keeps trying to operate on the root view of the viewstub, causing it to fail to compile. Is there any way to do this as a bindingadapter rather than having to do it programmatically in the activity? Here's what I have so far: @BindingAdapter("inflateWhen") fun inflateWhen(viewstub: ViewStub, inflate: Boolean) { if (inflate) { viewstub

How to add button in first row of datagrid column?

我的未来我决定 提交于 2021-01-28 08:08:24
问题 Hello I am developing one wpf application. I am using datagrid from wpf toolkit. I am binding grid by provider item source from database. it works fine. Now i want to add button in first row in some column, so is there any way to add button ? 回答1: <DataGrid Name="dgtest"> <DataGrid.Columns> <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="button" Content="click me" Visibility="Collapsed" /> <DataTemplate.Triggers> <DataTrigger Binding="{Binding

Getting SwiftUI wrapper of AVPlayer to pause when view disappears

我是研究僧i 提交于 2021-01-28 00:45:09
问题 TL;DR Can't seem to use binding to tell wrapped AVPlayer to stop — why not? The "one weird trick" from Vlad works for me, without state & binding, but why? See Also My question is something like this one but that poster wanted to wrap an AVPlayerViewController and I want to control playback programmatically. This guy also wondered when updateUIView() was called. What happens (Console logs shown below.) With code as shown here, The user taps "Go to Movie" MovieView appears and the vid plays

How to bind a dictionary to a gridview?

◇◆丶佛笑我妖孽 提交于 2021-01-27 18:18:17
问题 Is it possible to automatically bind a Dictionary to a Gridview? The closest I've got is: Dictionary<string, myObject> MyDictionary = new Dictionary<string, myObject>(); // Populate MyDictionary here. Grid1.DataSource = MyDictionary.Values; Grid1.DataBind(); This binds the properties in myObject to the gridview, but I'd like to get the key as well. If it's not possible, is there an alternative, e.g. use a repeater? Thanks. 回答1: You can use: var data = MyDictionary.Select(x => new List<object>