Binding on textbox when click on button command using mvvm

Oct 21, 2010 at 7:53 AM

hi,
I'm New to WPF and MVVM, I have to perform Paging
Clicking on Next Button ,Current Page show on Textbox from viewmodel

XAML:
<Button Grid.Row="0" Grid.Column="2" x:Name="Next" Content=" Next" Command="{Binding Path=NextRecord}" />
<TextBlock x:Name="txtCurrentPage" DataContext="{Binding}" Text="{Binding CurrentPage, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Grid.Row="0" Grid.Column="7"  />

Viewmodel:
this.NextRecord = new DelegateCommand<object>(this.OnNextRecord);
 public ICommand NextRecord{  get; private set;  }
private void OnNextRecord(object obj)
        {
            if (CurrentPage != TotalPage)
            {
                this.CurrentPage = CurrentPage + 1;
            }
}
 public int CurrentPage
        {
            get
            {
                return this._CurrentPage;
            }
            set
            {
                if(this._CurrentPage != value)
                {
                    this._CurrentPage = value;
                    base.OnPropertyChanged("CurrentPage");
                }              
            }
        }      
In Viewmodel i'm getting Currentpage values, but i cann't get in View-Xaml .