/// <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; } }
/// <summary> /// Create a InstallPythonPackageView with default values. /// </summary> public InstallPythonPackageView(IServiceProvider serviceProvider, bool isInsecure, bool supportConda) { _serviceProvider = serviceProvider; _supportsConda = supportConda; InstallUsing = InstallUsingOptions.First(); _isInsecure = isInsecure; PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged); }
public DependencyManager(INotifyPropertyChanged instance, PropertyChangedEventHandler propertyChangedEventHandler) { Instance = instance; PropertyChangedEventHandler = propertyChangedEventHandler; Initialize(); }
public RadioPanel() : base() { PanelLayout = LayoutType.UserDefined; EnumType = typeof(LayoutType); _processPropertyChange = true; _pceh = new PropertyChangedEventHandler(radioButtonPanel_PropertyChanged); }
private void Raise(PropertyChangedEventHandler handler, string propertyName) { if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } }
public IssuesListView(IIssuesServiceConnection service, string message, string[] files) { PropertyChanged += new PropertyChangedEventHandler(DebugPropertyChanged); _service = service; _comments = message; _filters.ReplaceContents(_service.GetFilters()); _assignees.AddRange(new IIssueUser[] { ReportedByUser.Instance, _service.CurrentUser }); _assignees.AddRange(_service.GetUsers()); _serializer = new ObjectSerializer(this, "_filters.SelectedText", "_assignedFilter.SelectedText", "_statusFilter.SelectedText", "_actions.SelectedText", "_assignees.SelectedText" ); _serializer.ContinueOnError = true; _serializer.Deserialize(_storage); // if no filter is pre-selected, select the last one, as this is the search filter // this increases the performance (no need to display all items) if (_filters.SelectedIndex == -1 && _filters.Count > 0) _filters.SelectedIndex = _filters.Count - 1; ServerFilterChanged(String.Empty); }
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))); } }
/// <summary> /// This method is commonly used by other classes, providing one implementation /// here to eliminate duplicate code. /// </summary> /// <param name="propertyName"></param> /// <param name="propertyChanged">By storing the event handler in this variable, we eliminate a race condition /// where the original event handler becomes null and we later try to dereference it.</param> public static void OnPropertyChanged(object sender, string propertyName, PropertyChangedEventHandler propertyChanged) { if (propertyChanged != null) { propertyChanged(sender, new PropertyChangedEventArgs(propertyName)); } }
public PlayerView() { InitializeComponent(); this.DataContextChanged += new DependencyPropertyChangedEventHandler(PlayerInfoView_DataContextChanged); _OnPropertyChanged = new PropertyChangedEventHandler(model_PropertyChanged); Unloaded += PlayerView_Unloaded; }
public PropertyChangedEventListener(INotifyPropertyChanged source, PropertyChangedEventHandler handler) { if (source == null) { throw new ArgumentNullException("source"); } if (handler == null) { throw new ArgumentNullException("handler"); } this.source = source; this.handler = handler; }
internal OpenFileLocalization(PropertyChangedEventHandler eventHandler = null) { PropertyBag = new PropertyBagCollection<string>("<Empty>", RaisePropertyChanged); Set1033Default(null, new EventArgs()); if (null != eventHandler) this.PropertyChanged += eventHandler; }
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"); } }
public MyUserControl() { InitializeComponent(); DataContextChanged += (sender, e) => { UserName = MyDataContext.UserName; PropertyChanged += (o, args) => { if (args.PropertyName == "UserName") { MyDataContext.UserName = (string) o; } }; }; var dpd = DependencyPropertyDescriptor.FromProperty(UserNameProperty, typeof (MyUserControl)); if (dpd != null) { dpd.AddValueChanged(this, delegate { // .. MyDataContext.UserName = UserName; }); } }
public Book(string author, string name, int year, PropertyChangedEventHandler propertyChanged) { this.author = author; this.name = name; this.year = year; PropertyChanged = propertyChanged; }
public static void Notify(object caller, PropertyChangedEventHandler handler, [CallerMemberName] string propertyName="") { if(handler!=null) { handler(caller, new PropertyChangedEventArgs(propertyName)); } }
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); } }
public Student(string name, int age) { this.args = new ModifiedEventArgs(); this.onChange += new PropertyChangedEventHandler(ActionPerformed); this.Name = name; this.Age = age; }
public IssuesListView(IIssuesServiceConnection service, string message, string[] files) { PropertyChanged += new PropertyChangedEventHandler(DebugPropertyChanged); _service = service; _comments = message; _filters.ReplaceContents(_service.GetFilters()); _assignees.AddRange(new IIssueUser[] { ReportedByUser.Instance, _service.CurrentUser }); _assignees.AddRange(_service.GetUsers()); _serializer = new ObjectSerializer(this, "_filters.SelectedText", "_assignedFilter.SelectedText", "_statusFilter.SelectedText", "_actions.SelectedText", "_assignees.SelectedText" ); _serializer.ContinueOnError = true; _serializer.Deserialize(_storage); // if no filter is pre-selected, select the first one, otherwise window comes up in odd state if (_filters.SelectedIndex == -1 && _filters.Count > 0) _filters.SelectedIndex = 0; ServerFilterChanged(String.Empty); }
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; }
/// <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; }
protected internal DefaultableSettings(DefaultSettings defaultSettings, PropertyChangedEventHandler eventHandler = null) { DefaultSettings = defaultSettings; PropertyBag = new PropertyBagCollection<DefaultBoolean>(DefaultBoolean.Default, RaisePropertyChanged); if (null != eventHandler) this.PropertyChanged += eventHandler; }
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(); }
public MainPlayerView() { InitializeComponent(); this.DataContextChanged += new DependencyPropertyChangedEventHandler(PlayerInfoView_DataContextChanged); _OnPropertyChanged = new PropertyChangedEventHandler(model_PropertyChanged); handCardArea.OnHandCardMoved += handCardArea_OnHandCardMoved; }
// 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 }
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; }
public static void RegisterPropertyChanged(this IEnumerable<Param> that, PropertyChangedEventHandler handler) { foreach (var param in that) { param.PropertyChanged += handler; } }
/// <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"; }
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; }
internal TemplateFoldersSettings(DefaultSettings defaultSettings, PropertyChangedEventHandler eventHandler = null) : base(defaultSettings, eventHandler) { FolderTemplates = new TemplateFolderDescriptionCollection(); DontFireEvents = true; PropertyBag.Add("Visible", DefaultBoolean.False); DontFireEvents = false; }
public object AddPropertyChangedListener( object target, PropertyChangedEventHandler listener ) { EventHandler changedHandler = ( sender, args ) => { listener.Invoke( this, new PropertyChangedEventArgs( "S" ) ); }; ( ( TargetClass ) target ).SChanged += changedHandler; return changedHandler; }
protected virtual void OnPropertyChanged(string propertyName) { Application.Current.Dispatcher.BeginInvoke((Action)(() => { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } })); }
// Create the OnPropertyChanged method to raise the event protected void OnPropertyChanged(string name) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } EffectPropertyNotifier.Instance.PostPropertyChanged(name); }
public void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); Model.DAL.DALClient bdd = new Model.DAL.DALClient(); bdd.UpdateClient(this); } }
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { Context.Send(s => { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } }, null); }
/// <summary> /// Raises the delegate for the property identified by a lambda expression. /// </summary> /// <typeparam name="TObject">The type of object containing the property.</typeparam> /// <typeparam name="TProperty">The type of the property.</typeparam> /// <param name="handler">The delegate to raise. If this parameter is null, then no action is taken.</param> /// <param name="sender">The object raising this event.</param> /// <param name="expression">The lambda expression identifying the property that changed.</param> public static void Raise <TObject, TProperty>( this PropertyChangedEventHandler handler, TObject sender, Expression <Func <TObject, TProperty> > expression) { handler?.Invoke(sender, new PropertyChangedEventArgs(sender.GetPropertyNameByExpression <TObject, TProperty>(expression) )); }
/// <summary> /// The Set /// </summary> /// <typeparam name="T">The property type.</typeparam> /// <param name="sender">The sender.</param> /// <param name="propertyChanged">The property changed.</param> /// <param name="field">The field.</param> /// <param name="value">The value.</param> /// <param name="propertyName">Name of the property.</param> /// <param name="propertyNames">The property names.</param> /// <returns> True if old value and new value are different. </returns> public static bool Set <T>(this INotifyPropertyChanged sender, PropertyChangedEventHandler propertyChanged, ref T field, T value, [CallerMemberName] string propertyName = null, params string[] propertyNames) { if (EqualityComparer <T> .Default.Equals(field, value)) { return(false); } field = value; propertyChanged?.Invoke(sender, new PropertyChangedEventArgs(propertyName)); return(true); }
/// <summary> /// Notify subscribers of updates to the named property /// </summary> /// <param name="propertyName">The full, case-sensitive, name of a property.</param> protected void NotifyPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { PropertyChangedEventArgs args = new PropertyChangedEventArgs(propertyName); handler(this, args); } }
public static void SubscribeNotify(this object @obj, PropertyChangedEventHandler propertyChangedEventHandler) { @obj.SaftyInvoke <INotifyPropertyChanged>(notifyInfo => { notifyInfo.PropertyChanged += propertyChangedEventHandler; //notifyInfo.PropertyChanged += WeakPropertyChangedEventHandlerFactory.MakeWeak(propertyChangedEventHandler, (handler, param) => //{ // notifyInfo.PropertyChanged -= handler; //}, null); }); }
protected void OnPropertyChanged(PropertyChangedEventArgs e) { // ISSUE: reference to a compiler-generated field PropertyChangedEventHandler propertyChanged = this.PropertyChanged; if (propertyChanged == null) { return; } propertyChanged((object)this, e); }
protected virtual void OnPropertyChanged(string propertyName) { this.VerifyPropertyName(propertyName); PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } }
/// <summary> /// Raises this object's PropertyChanged event. /// </summary> /// <param name="propertyName">The property that has a new value.</param> protected virtual void RaisePropertyChanged(string propertyName) { VerifyPropertyName(propertyName); PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { var e = new PropertyChangedEventArgs(propertyName); handler(this, e); } }
public void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { var e = new PropertyChangedEventArgs(propertyName); handler(this, e); } }
public CellControl() { _listView = new Lazy <ListView>(GetListView); DataContextChanged += OnDataContextChanged; Loaded += OnLoaded; Unloaded += OnUnloaded; _propertyChangedHandler = OnCellPropertyChanged; }
protected bool SetProperty <T>(ref T field, T newValue, [CallerMemberName] string propertyName = null) { if (!EqualityComparer <T> .Default.Equals(field, newValue)) { field = newValue; PropertyChangedEventHandler handler = PropertyChanged; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); return(true); } return(false); }
/// <summary> /// Fires the property changed event. /// </summary> private void NotifyPropertyChanged(String propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { Debug.Assert(this.syncContext != null); this.syncContext.Post(() => handler(this, new PropertyChangedEventArgs(propertyName))); } }
/// <summary> /// Notifies listeners that a property has changed. /// </summary> /// <param name="propertyName"> /// The name of a property that has changed. /// </param> protected void NotifyPropertyChanged(string propertyName) { Debug.Assert(!String.IsNullOrEmpty(propertyName)); PropertyChangedEventHandler eh = this.PropertyChanged; if (null != eh) { eh(this, new PropertyChangedEventArgs(propertyName)); } }
protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler == null) { return; } handler(this, new PropertyChangedEventArgs(propertyName)); }
/// <summary> /// Adds a weak event listener for a PropertyChanged event. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="handler">The event handler.</param> /// <exception cref="ArgumentNullException">source must not be <c>null</c>.</exception> /// <exception cref="ArgumentNullException">handler must not be <c>null</c>.</exception> protected void AddWeakEventListener(INotifyPropertyChanged source, PropertyChangedEventHandler handler) { if (source == null) { throw new ArgumentNullException("source"); } if (handler == null) { throw new ArgumentNullException("handler"); } PropertyChangedEventListener listener = new PropertyChangedEventListener(source, handler); propertyChangedListeners.Add(listener); PropertyChangedEventManager.AddListener(source, listener, ""); }
protected void OnPropertyChanged([CallerMemberName] string propertyName = "") { PropertyChangedEventHandler changed = PropertyChanged; if (changed == null) { return; } changed.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
private void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); PropertyChanged(this, new PropertyChangedEventArgs(info)); PersonneORM.updatePersonne(this); } }
private void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); this.PropertyChanged(this, new PropertyChangedEventArgs(info)); EstimationORM.updateEstimation(this); } }
protected void OnPropertyChanged(params string[] propertyNames) { foreach (string name in propertyNames) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } } }
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { Deployment.Current.Dispatcher.BeginInvoke(() => { handler(this, new PropertyChangedEventArgs(propertyName)); }); } }
public void UnsubsribeAll() { if (PropertyChanged != null) { foreach (Delegate @delegate in PropertyChanged.GetInvocationList()) { PropertyChangedEventHandler handler = @delegate as PropertyChangedEventHandler; PropertyChanged -= handler; } } }
public JibGrid() { Filters = new List <ColumnFilterControl>(); _filterHandler = new PropertyChangedEventHandler(filter_PropertyChanged); InitializeComponent(); Style = GetStyle("DataGridStyle"); CellStyle = GetStyle("DataGridCellStyle"); //in App.xaml in your application, you need to update the DataGridStyle and DataGridCellStyle styles //Jib.WPF.Testbed shows an example that conforms to the MahApps Teal light theme }
protected virtual void OnPropertyChanged() { _reload(); PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs("")); } }
public void NotInvokedWhenSourcePropertyIsSetWithDefaultPropertyTest() { int handlerInvokedCount = 0; PropertyChangedEventHandler handler = (sender, e) => { handlerInvokedCount++; }; var foo = new Foo <int>(); Bind(foo, handler); foo.SourceProperty = new Foo <int> .Bar(); Contract.Assert(handlerInvokedCount == 0); }
private void OnPropertyChanged(string name) { SaveToFile(); PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } }
private void NotifyPropertyChanged(string propertyName){ PropertyChangedEventHandler cb_copy = null; lock(sync){ if(cb!=null){ cb_copy = cb.Clone() as PropertyChangedEventHandler; } } if (cb_copy != null) { cb_copy(this, new PropertyChangedEventArgs(propertyName)); } }
private void SubscribeToChildPropertyChanged(IInvocation invocation, string propertyName, object newValue) { var newChild = newValue as INotifyPropertyChanged; if (newChild != null && !_PropertyChangedEventHandlers.ContainsKey(propertyName)) { PropertyChangedEventHandler newHandler = (object sender, PropertyChangedEventArgs e) => RaisePropertyChanged(invocation.Proxy, propertyName); newChild.PropertyChanged += newHandler; _PropertyChangedEventHandlers.Add(propertyName, newHandler); } }