wpf 下不同类型文件使用mvvm模式绑定控件属性方式
1.绑定新建类文件(使用BindableBase方式)
public class sample:BindableBase { private double blendPreVolume; /// <summary> /// 混匀前吸体积 /// </summary> public double BlendPreVolume { get => blendPreVolume; set => SetProperty(ref blendPreVolume, value); } }
2.绑定类似于控件类,如usercontrol、window(使用INotifyPropertyChanged方式)
public partial class SampleDataStandardCurveControl : UserControl, INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged;
       // 当属性值改变时调用此方法
          protected void OnPropertyChanged(string name)
          {
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
          }
private ObservableCollection<string> internalStandards = new ObservableCollection<string>(); public ObservableCollection<string> InternalStandards { get { return internalStandards; } set { internalStandards = value; OnPropertyChanged(nameof(InternalStandards)); } } }
------------------------------------
承接
**视觉检测软件开发及调试
**工业软件开发
**上位机软件开发
wechat:luoran2024
qq:565934058
email:taoyuansu@qq.com
海量教育资源及影视资源下载
微信公众号:EFun科技
------------------------------------
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号