• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PropertyChangedEventHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PropertyChangedEventHandler的典型用法代码示例。如果您正苦于以下问题:C# PropertyChangedEventHandler类的具体用法?C# PropertyChangedEventHandler怎么用?C# PropertyChangedEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyChangedEventHandler类属于命名空间,在下文中一共展示了PropertyChangedEventHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PropertyChangedRegistration

        /// <summary>Initializes a new instance of the <see cref="PropertyChangedRegistration"/> class.</summary>
        /// <param name="handler">The handler to which all change notifications are forwarded.</param>
        /// <param name="properties">The properties for which change notifications should be forwarded.</param>
        /// <exception cref="ArgumentException">One or more elements of <paramref name="properties"/> equal <c>null</c>.
        /// </exception>
        /// <exception cref="ArgumentNullException"><paramref name="handler"/> and/or <paramref name="properties"/>
        /// equal <c>null</c>.</exception>
        /// <remarks>After construction, each change to one of the properties in <paramref name="properties"/> is
        /// forwarded to <paramref name="handler"/> until <see cref="Dispose"/> is called.</remarks>
        public PropertyChangedRegistration(
            PropertyChangedEventHandler handler, params IProperty<INotifyPropertyChanged>[] properties)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            if (Array.IndexOf(properties, null) >= 0)
            {
                throw new ArgumentException("Array elements cannot be null.", nameof(properties));
            }

            this.handler = handler;
            this.propertyNames = properties.ToLookup(p => p.Owner, p => p.PropertyInfo.Name);

            foreach (var grouping in this.propertyNames)
            {
                grouping.Key.PropertyChanged += this.OnPropertyChanged;
            }
        }
开发者ID:Lawo,项目名称:ember-plus-sharp,代码行数:35,代码来源:PropertyChangedRegistration.cs


示例2: Bind

        public static Action Bind(this UISwitch toggle, INotifyPropertyChanged source, string propertyName)
        {
            var property = source.GetProperty(propertyName);

            if (property.PropertyType == typeof(bool))
            {
                toggle.SetValue(source, property);
                var handler = new PropertyChangedEventHandler ((s, e) =>
                {
                    if (e.PropertyName == propertyName)
                    {
                            toggle.InvokeOnMainThread(()=>
                                toggle.SetValue(source, property));
                    }
                });

                source.PropertyChanged += handler;

                var valueChanged = new EventHandler(
                    (sender, e) => property.GetSetMethod().Invoke (source, new object[]{ toggle.On }));

                toggle.ValueChanged += valueChanged;

                return new Action(() =>
                {
                    source.PropertyChanged -= handler;
                    toggle.ValueChanged -= valueChanged;
                });
            } 
            else
            {
                throw new InvalidCastException ("Binding property is not boolean");
            }
        }
开发者ID:Qwin,项目名称:SimplyMobile,代码行数:34,代码来源:SwitchExtensions.cs


示例3: Intercept

        public override void Intercept(IInvocation invocation)
        {
            // WPF will call a method named add_PropertyChanged to subscribe itself to the property changed events of
            // the given entity. The method to call is stored in invocation.Arguments[0]. We get this and add it to the
            // proxy subscriber list.
            if (invocation.Method.Name.Contains("PropertyChanged"))
            {
                PropertyChangedEventHandler propertyChangedEventHandler = (PropertyChangedEventHandler)invocation.Arguments[0];
                if (invocation.Method.Name.StartsWith("add_"))
                {
                    subscribers += propertyChangedEventHandler;
                }
                else
                {
                    subscribers -= propertyChangedEventHandler;
                }
            }

            // Here we call the actual method of the entity
            base.Intercept(invocation);

            // If the method that was called was actually a proeprty setter (set_Line1 for example) we generate the
            // PropertyChanged event for the property but with event generator the proxy. This must do the trick.
            if (invocation.Method.Name.StartsWith("set_"))
            {
                subscribers(invocation.InvocationTarget, new PropertyChangedEventArgs(invocation.Method.Name.Substring(4)));
            }
        }
开发者ID:MatiasBjorling,项目名称:EcoLoad,代码行数:28,代码来源:DataBindingIntercepter.cs


示例4: PlayerView

 public PlayerView()
 {
     InitializeComponent();
     this.DataContextChanged += new DependencyPropertyChangedEventHandler(PlayerInfoView_DataContextChanged);
     _OnPropertyChanged = new PropertyChangedEventHandler(model_PropertyChanged);
     Unloaded += PlayerView_Unloaded;
 }
开发者ID:kingling,项目名称:sgs,代码行数:7,代码来源:PlayerView.xaml.cs


示例5: Book

 public Book(string author, string name, int year, PropertyChangedEventHandler propertyChanged)
 {
     this.author = author;
     this.name = name;
     this.year = year;
     PropertyChanged = propertyChanged;
 }
开发者ID:abdonkov,项目名称:HackBulgaria-CSharp,代码行数:7,代码来源:Book.cs


示例6: MainPlayerView

 public MainPlayerView()
 {
     InitializeComponent();
     this.DataContextChanged += new DependencyPropertyChangedEventHandler(PlayerInfoView_DataContextChanged);
     _OnPropertyChanged = new PropertyChangedEventHandler(model_PropertyChanged);
     handCardArea.OnHandCardMoved += handCardArea_OnHandCardMoved;
 }
开发者ID:maplegh,项目名称:sgs,代码行数:7,代码来源:MainPlayerView.xaml.cs


示例7: Bind

        public static PropertyChangedEventHandler Bind(this SeekBar seekBar, INotifyPropertyChanged source, string propertyName)
        {
            var property = source.GetProperty(propertyName);

            var r = property.GetCustomAttribute<RangeAttribute> ();

            if (r != null)
            {
                seekBar.Max = (int)r.Maximum;
            }

            var handler = new PropertyChangedEventHandler ((s, e) =>
                {
                    if (e.PropertyName == propertyName)
                    {
                        //textField.SetText(source, property);
                    }
                });

            source.PropertyChanged += handler;

            //textField.AfterTextChanged += (sender, e) => property.GetSetMethod().Invoke(source, new []{textField.Text});

            return handler;
        }
开发者ID:Qwin,项目名称:SimplyMobile,代码行数:25,代码来源:SeekBarExtensions.cs


示例8: Composition

 public Composition(string path, PropertyChangedEventHandler PropertyChanged)
 {
     this.PropertyChanged += PropertyChanged;
     FileInfo = TagLib.File.Create(path);
     if (FileInfo.Tag.Artists.Length == 0)
         Artists = "Unknown artist";
     else
     {
         foreach (string str in FileInfo.Tag.Artists)
         {
             Artists += str;
             Artists += "; ";
         }
         Artists = Artists.Substring(0, Artists.Length - 2);
     }
     if (FileInfo.Tag.Title == null)
         Title = "Unknown title";
     else
         Title = FileInfo.Tag.Title;
     if (FileInfo.Tag.Album == null)
         Album = "Unknown album";
     else
         Album = FileInfo.Tag.Album;
     Name = FileInfo.Name;
     Image = new BitmapImage();
     Image.BeginInit();
     if (FileInfo.Tag.Pictures.Length != 0)
         Image.StreamSource = new MemoryStream(FileInfo.Tag.Pictures[0].Data.Data);
     else
         Image.UriSource = new Uri("Content\\note-blue.png", UriKind.RelativeOrAbsolute);
     Image.EndInit();
 }
开发者ID:nikoir,项目名称:AudioPlayer,代码行数:32,代码来源:Composition.cs


示例9: AddPropertyChangedListener

 public object AddPropertyChangedListener( object target, PropertyChangedEventHandler listener ) {
     EventHandler changedHandler = ( sender, args ) => {
         listener.Invoke( this, new PropertyChangedEventArgs( "S" ) );
     };
     ( ( TargetClass ) target ).SChanged += changedHandler;
     return changedHandler;
 }
开发者ID:furesoft,项目名称:consoleframework,代码行数:7,代码来源:AdapterTest.cs


示例10: ProfilingTargetView

        /// <summary>
        /// Create a ProfilingTargetView with default values.
        /// </summary>
        public ProfilingTargetView() {
            var solution = NodejsProfilingPackage.Instance.Solution;
            
            var availableProjects = new List<ProjectTargetView>();
            foreach (var project in solution.EnumerateLoadedProjects(onlyNodeProjects: true)) {
                availableProjects.Add(new ProjectTargetView((IVsHierarchy)project));
            }
            _availableProjects = new ReadOnlyCollection<ProjectTargetView>(availableProjects);

            _project = null;
            _standalone = new StandaloneTargetView();
            _isProjectSelected = true;

            _isValid = false;

            PropertyChanged += new PropertyChangedEventHandler(ProfilingTargetView_PropertyChanged);
            _standalone.PropertyChanged += new PropertyChangedEventHandler(Standalone_PropertyChanged);

            var startupProject = NodejsProfilingPackage.Instance.GetStartupProjectGuid();
            Project = AvailableProjects.FirstOrDefault(p => p.Guid == startupProject) ??
                AvailableProjects.FirstOrDefault();
            if (Project != null) {
                IsStandaloneSelected = false;
                IsProjectSelected = true;
            } else {
                IsProjectSelected = false;
                IsStandaloneSelected = true;
            }
            _startText = Resources.ProfilingStart;
        }
开发者ID:munyirik,项目名称:nodejstools,代码行数:33,代码来源:ProfilingTargetView.cs


示例11: MainPage

        // Constructeur
        public MainPage()
        {
            InitializeComponent();
            this.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);
            Failure_Handler = new PropertyChangedEventHandler(FailureOccured);

            _viewModel = DataContext as MainPageVM;
            _viewModel.PropertyChanged += VM_PropertyChanged;

            ViewModelLocator.Client.PropertyChanged += Failure_Handler;

            version_text.Text = Helper.GetVersionNumber();

            ApplicationBar.Buttons.Add(new ApplicationBarIconButton()
            {
                Text = AppLanguage.AppBar_Refresh,
                IconUri = new Uri("/icons/appbar.refresh.rest.png", UriKind.Relative)
            });
            (ApplicationBar.Buttons[0] as ApplicationBarIconButton).Click += Sync_Btn_Click;

            ApplicationBar.MenuItems.Add(new ApplicationBarMenuItem(AppLanguage.AppBar_Settings));
            (ApplicationBar.MenuItems[0] as ApplicationBarMenuItem).Click += SettingsPage_Click;
#if DEBUG
            ApplicationBar.MenuItems.Add(new ApplicationBarMenuItem("[DEV] CLEAR"));
            (ApplicationBar.MenuItems[1] as ApplicationBarMenuItem).Click += DEV_clrDB_Click ;
#endif
        }
开发者ID:Okhoshi,项目名称:Claroline.WindowsPhone,代码行数:28,代码来源:MainPage.xaml.cs


示例12: Student

 public Student(string name, int age)
 {
     this.args = new ModifiedEventArgs();
     this.onChange += new PropertyChangedEventHandler(ActionPerformed);
     this.Name = name;
     this.Age = age;
 }
开发者ID:shnogeorgiev,项目名称:Software-University-Courses,代码行数:7,代码来源:Student.cs


示例13: DefaultableSettings

 protected internal DefaultableSettings(DefaultSettings defaultSettings, PropertyChangedEventHandler eventHandler = null)
 {
     DefaultSettings = defaultSettings;
     PropertyBag = new PropertyBagCollection<DefaultBoolean>(DefaultBoolean.Default, RaisePropertyChanged);
     if (null != eventHandler)
         this.PropertyChanged += eventHandler;
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:7,代码来源:DefaultableSettings.cs


示例14: ProfilingTargetView

        /// <summary>
        /// Create a ProfilingTargetView with default values.
        /// </summary>
        public ProfilingTargetView(IServiceProvider serviceProvider) {
            var solution = serviceProvider.GetService(typeof(SVsSolution)) as IVsSolution;
            
            var availableProjects = new List<ProjectTargetView>();
            foreach (var project in solution.EnumerateLoadedProjects()) {
                availableProjects.Add(new ProjectTargetView((IVsHierarchy)project));
            }
            _availableProjects = new ReadOnlyCollection<ProjectTargetView>(availableProjects);

            _project = null;
            _standalone = new StandaloneTargetView(serviceProvider);
            _isProjectSelected = true;

            _isValid = false;

            PropertyChanged += new PropertyChangedEventHandler(ProfilingTargetView_PropertyChanged);
            _standalone.PropertyChanged += new PropertyChangedEventHandler(Standalone_PropertyChanged);

            var startupProject = PythonProfilingPackage.GetStartupProjectGuid(serviceProvider);
            Project = AvailableProjects.FirstOrDefault(p => p.Guid == startupProject) ??
                AvailableProjects.FirstOrDefault();
            if (Project != null) {
                IsStandaloneSelected = false;
                IsProjectSelected = true;
            } else {
                IsProjectSelected = false;
                IsStandaloneSelected = true;
            }
            _startText = "_Start";
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:33,代码来源:ProfilingTargetView.cs


示例15: OpenFileLocalization

 internal OpenFileLocalization(PropertyChangedEventHandler eventHandler = null)
 {
     PropertyBag = new PropertyBagCollection<string>("<Empty>", RaisePropertyChanged);
     Set1033Default(null, new EventArgs());
     if (null != eventHandler)
         this.PropertyChanged += eventHandler;
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:7,代码来源:OpenFileLocalization.cs


示例16: RegisterPropertyChanged

 public static void RegisterPropertyChanged(this IEnumerable<Param> that, PropertyChangedEventHandler handler)
 {
     foreach (var param in that)
     {
         param.PropertyChanged += handler;
     }
 }
开发者ID:Lundalogik,项目名称:isop,代码行数:7,代码来源:ParamExtension.cs


示例17: BassEngine

 public BassEngine(PropertyChangedEventHandler PropertyChanged)
 {
     Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
     Compositions = new ObservableCollection<Composition>();
     Compositions.CollectionChanged += Compositions_CollectionChanged;
     Volume = 50;
 }
开发者ID:nikoir,项目名称:AudioPlayer,代码行数:7,代码来源:BassEngine.cs


示例18: TemplateFoldersSettings

 internal TemplateFoldersSettings(DefaultSettings defaultSettings, PropertyChangedEventHandler eventHandler = null) : base(defaultSettings, eventHandler)
 {
     FolderTemplates = new TemplateFolderDescriptionCollection();
     DontFireEvents = true;
     PropertyBag.Add("Visible", DefaultBoolean.False);
     DontFireEvents = false;
 }
开发者ID:netintellect,项目名称:NetOffice,代码行数:7,代码来源:TemplateFoldersSettings.cs


示例19: StandaloneTargetView

        public StandaloneTargetView(IServiceProvider serviceProvider) {
            var componentService = serviceProvider.GetComponentModel();
            
            var interpreterProviders = componentService.DefaultExportProvider.GetExports<IPythonInterpreterFactoryProvider, Dictionary<string, object>>();
            var interpreterOptions = componentService.GetService<IInterpreterOptionsService>();
            var registry = componentService.GetService<IInterpreterRegistryService>();
            var pythonService = serviceProvider.GetPythonToolsService();

            var availableInterpreters = registry.Configurations.Select(
                config => new PythonInterpreterView(
                    config.Description, 
                    config.Id, 
                    config.InterpreterPath
                )
            ).ToList();

            _customInterpreter = new PythonInterpreterView("Other...", "", null);
            availableInterpreters.Add(_customInterpreter);
            _availableInterpreters = new ReadOnlyCollection<PythonInterpreterView>(availableInterpreters);

            _interpreterPath = null;
            _canSpecifyInterpreterPath = false;
            _scriptPath = null;
            _workingDirectory = null;
            _arguments = null;

            _isValid = false;

            PropertyChanged += new PropertyChangedEventHandler(StandaloneTargetView_PropertyChanged);

            if (IsAnyAvailableInterpreters) {
                var defaultId = interpreterOptions.DefaultInterpreterId;
                Interpreter = AvailableInterpreters.FirstOrDefault(v => v.Id == defaultId);
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:35,代码来源:StandaloneTargetView.cs


示例20: InvokeINotifyPropertyChangedMethod

        private IMethodReturn InvokeINotifyPropertyChangedMethod(IMethodInvocation input)
        {
            if (input.MethodBase.DeclaringType == typeof(INotifyPropertyChanged))
            {
                switch (input.MethodBase.Name)
                {
                    case "add_PropertyChanged":
                        lock (handlerLock)
                        {
                            handler = (PropertyChangedEventHandler)Delegate.Combine(handler, (Delegate)input.Arguments[0]);
                        }
                        break;

                    case "remove_PropertyChanged":
                        lock (handlerLock)
                        {
                            handler = (PropertyChangedEventHandler)Delegate.Remove(handler, (Delegate)input.Arguments[0]);
                        }
                        break;

                    default:
                        return input.CreateExceptionMethodReturn(new InvalidOperationException());
                }

                return input.CreateMethodReturn(null);
            }

            return null;
        }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:29,代码来源:NaiveINotifyPropertyChangedInterceptionBehavior.cs



注:本文中的PropertyChangedEventHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PropertyCollection类代码示例发布时间:2022-05-24
下一篇:
C# PropertyChangedEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap