Question Data Binding with Classes in Model

MartinP

New member
Joined
Apr 22, 2009
Messages
3
Programming Experience
3-5
Hi,

it seem to be a block in my head.

I try to build my first MVC-application. Fields (Text etc.) on the gui shall change their values as some attributes of the classes of the model are changed.

When I bind one attribute so several textboxes on the screen and change the content of on textbox the other textboxes change their values as desired.

When I change the attribute for example by a button that calls a method changing the value of the attribute (property) nothing happens on the screen. My debugging shows that the same Event is risen when changing the property by both ways. Only the first way makes the textboxes respond.

Where could I find a hint to find a way to solve my problem

Thanks

Martin


See:
+++++ Property
PublicProperty Name() As String
Get
Return aName
EndGet
Set(ByVal value As String)
aName = value
OnPropertyChanged("Name")
EndSet
EndProperty

+++++ Event
ProtectedSub OnPropertyChanged(ByVal prop AsString)
RaiseEvent PropertyChanged(Me,New PropertyChangedEventArgs(prop))
EndSub

+++++ XAML
Grid DataContext="{StaticResource pers1}">
...
<Label Grid.Column="0" Grid.Row="0">Zuname:</Label>
<TextBox Grid.Column="1" Grid.Row="0" Name="txtZuname"
Text="{Binding Path=Name}"/>
...
 
It might be a bit late now but I've moved this thread to the proper forum. As the description says, the ASP.NET MVC forum is for applications built on the ASP.NET MVC Framework ONLY. If you're building a WPF application using the MVC pattern then it belongs in the WPF forum. As well as that, you're probably better off investigating the MVVM pattern, which is more popular in the WPF community than MVC or MVP.
 
Back
Top