M
M
M3fist02015-09-17 12:54:35
WPF
M3fist0, 2015-09-17 12:54:35

Using Binding in WPF?

Hello!
Can you please tell me if it is possible to use bindings in WPF so that changes in the object affect the UI element? That being said, implement this without using INotifyPropertyChanged.
That is, I write in the XAML markup {Binding Path=SomeProperty, Mode=TwoWay}, in the code-behind I specify the DataContext for this control, and that's it. But with this method, when changing the SomeProperty property in the control object, it does not change its state. And, as far as I understand, in this case, the binding works once during startup.
Thanks in advance for your answers and advice :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2015-09-17
@Nipheris

> That being said, implement this without using INotifyPropertyChanged.
You at least briefly indicated the reason why this should not be done. Why am I interested in the reason? Because if you say “I don’t want to clog clean model classes that are used in several projects with all sorts of incomprehensible INotifyPropertyChanged” I will answer you “but you don’t need to touch them, ViewModel objects are created to implement INotifyPropertyChanged , which are attached to controls instead of model ones. They implement INPC, in addition, they can expose some properties in the view that are not in the model objects."
And if you say "I'm experimenting here", then you can file DependencyProperty in your bind object, although this is rather strange. But it should work.

W
WarFollowsMe, 2015-09-30
@WarFollowsMe

Can you please tell me if it is possible to use bindings in WPF so that changes in the object affect the UI element? That being said, implement this without using INotifyPropertyChanged.

No.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question