binding

WPF: Binding Margin/Thickness Left and Top Property

泄露秘密 提交于 2021-01-29 08:01:08
问题 I got a problem with bindings(i know why am i becoming this exception but dunno how to solve the problem). I have tried this piece of code. <TextBlock HorizontalAlignment="Left" > <TextBlock.Margin> <Thickness Left="{Binding POSX.Value, Converter={StaticResource DPIConverter}}" Top="{Binding POSY.Value, Converter={StaticResource DPIConverter}}"/> </TextBlock.Margin> </TextBlock> Im getting an exception where it says that, u cant bind thickness [LEFT], [TOP] properties. (ik why : cause those

SwiftUI - Getting TextField to array in ForEach

爷,独闯天下 提交于 2021-01-29 07:36:29
问题 The goal is to have a TextField that takes characters as they're being entered and display them below the TextField in a 'pile'. By pile I mean, each new character is displayed on top of the last one. Piling the letters up is easy enough - I use ForEach to loop over an array inside a ZStack . To get the characters in the array, I used a custom binding. It works, but the problem is that the characters get repeated each time a new character is typed. For example, if the user types CAT, first

The Binding of “this”

时光毁灭记忆、已成空白 提交于 2021-01-29 03:16:19
问题 I'm learning how the value of "this" binds in JavaScript. In the following example, is it correct to say that "this" binds to the getFriends() method instead of the "details" object, which is the reason this.name = "" instead of this.name = "Joe"? const details = { name: 'Joe', friends: [ 'Bob', 'Alex' ], getFriends: function() { this.friends.forEach( function( friend ) { console.log( this.name + " is friends with " + friend ); } ); } }; details.getFriends(); // Output: // is friends with Bob

Filtered Combobox ItemsSource binding issue

只谈情不闲聊 提交于 2021-01-28 23:15:00
问题 What I'm trying to do : I have 2 comboboxes, a "regular" one, and a filtrable one. On the filtrable combobox ItemsSource is binded to a property of the first combobox SelectedItem . Here is some XAML to demonstrate the relation (I removed some properties): <ComboBox Name="cbx_poche" ItemsSource="{Binding DataContext.ListePoches, ElementName=Main}" SelectedItem="{Binding PocheCible}" /> <controls:FilteredComboBox ItemsSource="{Binding SelectedItem.SupportsEligibles, ElementName=cbx_poche}"

How to bind a treeview in UWP to a ViewModel?

≡放荡痞女 提交于 2021-01-28 09:35:43
问题 I am currently working in UWP and I need to create a TreeView to store hierarchically a query of a service. example: Example I have I keep the information in a public ObservableCollection <Model> name_of_object {get; set; } = new ObservableCollection <Model> (); But I create the TreeView in the XAML and I do not see any way to do a Binding to the "SelectedItem" and "ItemSource" or any way to bring a query. Tried this solution: Recursive XAML binding data templates on the Universal Windows

UWP ListView bind SelectedItem to property in viewmodel

自闭症网瘾萝莉.ら 提交于 2021-01-28 08:32:49
问题 I'm trying to bind SelectedItem in a ListView to the property SelectedSection in the viewmodel. I'm getting the following error: "Invalid binding path 'ViewModel.SelectedSection' : Cannot bind type 'Model.Section' to 'System.Object' without a converter". I'm currently binding the ListView's ItemSource to a list in the CurrentProject property. I tried making a converter, but I'm not quite sure how and what I'm suppose to convert. I got the same error when I tried to just get the property I

WPF DataContext updated but UI not updated

牧云@^-^@ 提交于 2021-01-28 07:36:20
问题 I have maximum simple app. I want to fill listbox when button pressed. I use binding, window DataContext is updated after some operation, but UI not updated! Here is the code: MainWindow.xaml <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Button Content="Button" HorizontalAlignment="Left" Margin="432,288.04,0,0"

Xamarin form: IValueConverter receive null value in Convert method

孤人 提交于 2021-01-27 21:29:35
问题 I have a list view set with item source as child. I want to bind a child object to a view which will set the color through the converter. The converter method got called but the value i passed in was null . Apart from dot, I also use Path=/ but the value passed to the converter still null . If i bind the property, it's fine but not the current item. <ListView x:Name="childListView" VerticalOptions="FillAndExpand" HasUnevenRows="true" ItemSelected="OnItemSelected" ItemTapped="OnItemTapped">

Data binding - ActivityMainBinding.java error: too many parameters

主宰稳场 提交于 2021-01-25 06:55:37
问题 recently I have discovered DataBinding on Android. It was working great, I have followed some guides, but it works until my project gets more elements inside the view. Once a certain amount is reached I get: I can notice that every element I add to the view gets generated property in ActivityMainBinding.java seems like I have reached some limit? The whole xml is surrounded by <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"

UWP Using GetBindingExpression with x:Bind

你。 提交于 2021-01-23 06:17:03
问题 I am rewrite my UWP Application from Binding to x:Bind. I have a TextChanged Event on different Textboxes. With Binding I could use GetBindingExpression to update the Model. Is there an equivalent Methode for x:Bind? Or how could I make it with x:Bind? public void TextBox_TextChanged(object sender, TextChangedEventArgs e) { var binding = ((TextBox)sender).GetBindingExpression(TextBox.TextProperty); binding.UpdateSource(); } 回答1: I've tried to do this before without success. I think is not