CodePudding user response:
Ask everybody to help, very few points, solve it can help to download resourcesCodePudding user response:
The string binding to comcobox, combobox selected items change, the trigger propertyCodePudding user response:
Project is urgent, just contact with WPF, thank godCodePudding user response:
So, I give an example, the code is not much, should be able to help explain what is property change event,& lt; Windows x:
XMLNS="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
XMLNS: x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="450" Width="800" & gt;
public partial class MainWindow: Window
{
Public MainWindow ()
{
InitializeComponent();
Var my=new my () {Color="Blue"};
My. PropertyChanged +=delegate {MessageBox. Show (my) Color); };
ComboBox1. ItemsSource=new [] {" Red ", "Green", "Blue", "Yellow", "Cyan", "Magenta"};
ComboBox1. DataContext=my;
}
Public class My: INotifyPropertyChanged
{
The public event PropertyChangedEventHandler PropertyChanged;
Void NotifyPropertyChanged (string propertyName)
{
PropertyChanged? Invoke (this, new PropertyChangedEventArgs (propertyName));
}
String _color;
Public string Color
{
The get {return _color; }
The set {the if (_color! Value)={_color=value; NotifyPropertyChanged (nameof (Color)); }}
}
}
}