binding

Binding image value to path in wpf and c#

限于喜欢 提交于 2021-02-05 11:34:52
问题 I am strugling to bind value to path ImageSource. I get NullReferenceError when I try to set new value. My current code is: In MainWindow.xaml the Path code is following <Path x:Name="PPButton" Data="M110,97 L155,123 C135,150 135,203 153,227 L112,255 C80,205 80,150 110,97" Stretch="none" MouseEnter="Path_MouseEnter_1" MouseLeave="Path_MouseLeave_1" > <Path.Fill> <ImageBrush ImageSource="{Binding ImageSource}"/> </Path.Fill> </Path> on MainWindow.xaml.cs where I get error, I commented behind

How to write this java code to kotlin in Binding Adapter

泪湿孤枕 提交于 2021-02-05 09:28:35
问题 I have some lines of code written in onBindViewHolder in lang (java) .. I'm trying to write the exact code in kotlin in Binding Adapter , but i'm not able to write that EarthQuakeAdapter( JAVA) .. I tried but i was not able to write the same code to get magnitudeCircle , PrimaryLocation and LocationOffSet from onBindViewHolder(JAVA lang) method to Binding Adapter in kotlin which i posted below public class EarthquakeAdapter extends RecyclerView.Adapter<EarthquakeAdapter.MyViewHolder> {

How to write this java code to kotlin in Binding Adapter

吃可爱长大的小学妹 提交于 2021-02-05 09:27:48
问题 I have some lines of code written in onBindViewHolder in lang (java) .. I'm trying to write the exact code in kotlin in Binding Adapter , but i'm not able to write that EarthQuakeAdapter( JAVA) .. I tried but i was not able to write the same code to get magnitudeCircle , PrimaryLocation and LocationOffSet from onBindViewHolder(JAVA lang) method to Binding Adapter in kotlin which i posted below public class EarthquakeAdapter extends RecyclerView.Adapter<EarthquakeAdapter.MyViewHolder> {

Binding to properties in both the ViewModel and CodeBehind

核能气质少年 提交于 2021-02-05 07:51:30
问题 I have what I'm sure is a ridiculously ignorant question, but I'm asking it anyways because I've searched and searched and either don't understand the solutions I'm seeing or not finding exactly the answer I seek. I have an MVVM application. My XAML is setup with the DataContext set to the VM where the data items on the screen are populated from the VM's properties. My CodeBehind doesn't fiddle with the data, only things relating to the screen. What I want to do now is bind certain UI

Binding to properties in both the ViewModel and CodeBehind

五迷三道 提交于 2021-02-05 07:51:08
问题 I have what I'm sure is a ridiculously ignorant question, but I'm asking it anyways because I've searched and searched and either don't understand the solutions I'm seeing or not finding exactly the answer I seek. I have an MVVM application. My XAML is setup with the DataContext set to the VM where the data items on the screen are populated from the VM's properties. My CodeBehind doesn't fiddle with the data, only things relating to the screen. What I want to do now is bind certain UI

Update ListView when Collection datasource updates

不羁岁月 提交于 2021-02-05 07:34:24
问题 I have ListView which I am binding to a Dictionary collection, but new new items are added to the collection, the listview is not updating. How this can be achieved in WPF? 回答1: Both sides of WPF binding should support INotifyCollectionChanged interface in order to notify about collection changes. Dictionary does not support it. So you can either use ObservableCollection class (it does not provide functionality like search a value by associated key), or you can create you own

TwoWay Binding With ItemsControl

不打扰是莪最后的温柔 提交于 2021-02-05 02:21:45
问题 I'm trying to write a user control that has an ItemsControl, the ItemsTemplate of which contains a TextBox that will allow for TwoWay binding. However, I must be making a mistake somewhere in my code, because the binding only appears to work as if Mode=OneWay. This is a pretty simplified excerpt from my project, but it still contains the problem: <UserControl x:Class="ItemsControlTest.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas

TwoWay Binding With ItemsControl

喜你入骨 提交于 2021-02-05 02:21:34
问题 I'm trying to write a user control that has an ItemsControl, the ItemsTemplate of which contains a TextBox that will allow for TwoWay binding. However, I must be making a mistake somewhere in my code, because the binding only appears to work as if Mode=OneWay. This is a pretty simplified excerpt from my project, but it still contains the problem: <UserControl x:Class="ItemsControlTest.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas

WPF - Bound Control Not Updating When Property Changed?

吃可爱长大的小学妹 提交于 2021-02-04 21:08:55
问题 I've bound the Text property of a TextBox to a base object's property and it seems to work just fine. Unfortunately, when I programatically change the value of the property, it doesn't seem to update on the GUI. Here's the property: public string SealedDate { get { string result = string.Empty; if (_DACase.SealedDate != DateTime.MinValue) { result = Formatting.FormatDate(_DACase.SealedDate); } return result; } set { DateTime theDate = DateTime.MinValue; if (DateTime.TryParse(value, out

MVVM WPF ComboBox SelectedItem Binding not activated inside datagrid

穿精又带淫゛_ 提交于 2021-02-04 14:49:26
问题 I have struggled to save my combobox selected value when operating inside a datagrid. When I make a test solution with no datagrid things are working ok. The context are person names with associated countries. The countries are stored in a xml file. Here is a snapshot of the initial view: You see here the (important parts of the)PersonList.xaml: <UserControl.Resources> <XmlDataProvider x:Key="Dataxml" Source="\Properties\AllCountries.xml" /> <model:Person x:Key="Person"/> </UserControl