TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
bobby
NA
3
932
problem with binding a textBox
Dec 20 2014 6:22 AM
hi,
i'm trying to bind a simple textbox to a message string returned from object.
first i have a base class -
public class BaseClass : INotifyPropertyChanged
{
private string message
public string Message
{ get {return message;}
set
{ message = value;
OnPropertyChaned("Message");
}
}
public event PropertyChangedEventHandler propertyChanged;
private void OnPropertyChanged(string propertyName)
{
if(propertyChanged!=null)
propertyChanged(this, new PropertyChanedEventArgs(propertyName));
}
}
Also, i have a sub-class -
public Class SubClass : BaseClass
{
}
my viewModel class -
public class ViewModel
{
private BaseClass theClass;
public ViewModel()
{
base=new BaseClass();
}
public BaseClass TheClass
{
get{ return theClass;}
set{ theClass= value;}
}
private void someBtnClickMethod()
{
TheClass = new SubClass();
theClass.Message="123";
}
}
i'm binding the textBox with -
<TextBox Text="{Binding TheClass.Message, UpdateSourceTrigger=PropertyChaned}">
the problem is that when someBtnClickMethod function call than i have to change the object and then binding not working for me, message is not updated in textBox.
what's the problem? how can i fix that?
thanks in advanced.
Reply
Answers (
2
)
i want data from any given table from my editor.
Application.Current.Shutdown();