propertychanged

Dependency Properties' PropertyChangedCallback not getting called

a 夏天 提交于 2019-11-27 16:16:54
If have an own user control with a DependencyProperty and the corresponding callback method like below: public partial class PieChart : UserControl { public static readonly DependencyProperty RatesProperty = DependencyProperty.Register("Rates", typeof(ObservableCollection<double>), typeof(PieChart), new PropertyMetadata(new ObservableCollection<double>() { 1.0, 1.0 }, new PropertyChangedCallback(OnRatesChanged))); [...] public static void OnRatesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ((PieChart)d).drawChart(); } When using this user control, I bind an

how does PropertyChangedEventHandler work?

筅森魡賤 提交于 2019-11-27 11:42:40
问题 This is a really simple question, but I was wondering if someone could explain what the 4th line is actually doing? so the first line gives an event to the handler. I don't really know in what circumstances handler will return null or what the last line does. When you pass the handler your object and which property changed, what does it do with them? PropertyChangedEventHandler handler = PropertyChanged; //property changed is the event if (handler != null) { handler(this, new

jFormattedTextField's Formatter.setCommitsOnValidEdit(true) doesn't work at first focus

六月ゝ 毕业季﹏ 提交于 2019-11-27 09:35:14
I have a jFormattedTextField and I set setCommitsOnValidEdit to true then I added an event listener to "property change" on "value" property. At first focus of that jFormattedTextField it doesn't call event listener method when typing in it. But on "focusLost" it calls event listener and after that when it receives focus again it calls event listener when typing. I want the event listener be called after any change in any time in that jFormattedTextField (Even in the fist focus). What's the problem? How can I fix it? probably you have to look at DocumentListener example here EDIT: I know this

BindingProxy: binding to the indexed property

对着背影说爱祢 提交于 2019-11-27 04:52:49
问题 I have a BindingProxy to Bind the Visibility-Property of DataGridColumns of a DataGrid to a Value in a Dictionary ("ColumnsVisibility"). I Also have a Context-Menu, that should make it possible to hide/show the columns of the Grid. <DataGrid Name="dgMachines" ItemsSource="{Binding HVMachineList, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" > <DataGrid.Resources> <local:BindingProxy x:Key="proxy" Data="{Binding}"/> <ContextMenu x:Key="DataGridColumnHeaderContextMenu">

In WPF, why doesn't TemplateBinding work where Binding does?

孤人 提交于 2019-11-27 04:44:21
Ok... this is leaving me scratching my head. I have two WPF controls--one's a user control and the other's a custom control. Let's call them UserFoo and CustomFoo. In the control template for CustomFoo, I use an instance of UserFoo which is a named part so I can get to it after the template is applied. That works fine. Now both UserFoo and CustomFoo have a Text property defined on them (independently, i.e. not a shared DP using AddOwner. Don't ask...) that are both declared like this... public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof(string)

Raising a PropertyChanged event during a Pause in TextBox entry?

萝らか妹 提交于 2019-11-27 02:56:13
问题 I was wondering if it's possible to raise a PropertyChanged event when the user pauses while typing text into a TextBox ? Or more specifically, I want to run a method X seconds after the user stops typing in a TextBox. For example, I have a form with a TextBox and nothing else. The user types in a 1-9 digit Id value into the TextBox, a fairly resource-intensive background process loads the record. I do not want to use the UpdateSouceTrigger=PropertyChanged because that would cause the

Dependency Properties' PropertyChangedCallback not getting called

旧时模样 提交于 2019-11-26 22:26:21
问题 If have an own user control with a DependencyProperty and the corresponding callback method like below: public partial class PieChart : UserControl { public static readonly DependencyProperty RatesProperty = DependencyProperty.Register("Rates", typeof(ObservableCollection<double>), typeof(PieChart), new PropertyMetadata(new ObservableCollection<double>() { 1.0, 1.0 }, new PropertyChangedCallback(OnRatesChanged))); [...] public static void OnRatesChanged(DependencyObject d,

In WPF, why doesn&#39;t TemplateBinding work where Binding does?

谁说我不能喝 提交于 2019-11-26 11:11:10
问题 Ok... this is leaving me scratching my head. I have two WPF controls--one\'s a user control and the other\'s a custom control. Let\'s call them UserFoo and CustomFoo. In the control template for CustomFoo, I use an instance of UserFoo which is a named part so I can get to it after the template is applied. That works fine. Now both UserFoo and CustomFoo have a Text property defined on them (independently, i.e. not a shared DP using AddOwner. Don\'t ask...) that are both declared like this...