In the following code
// MVVM Views part class
public partial class DashBoard : UserControl
{
public DashBoard()
{
InitializeComponent();
this.DataContext = new DashBoardViewModel();
}
}
Could we use base.DataContext instead this.DataContext. In which case could we use base instead of this?
It’s usually clearer to use
this. You normally only specifybasewhen you want to explicitly call a base class constructor or the base implementation of an overridden method or property.Using
base.DataContextwould work, but it would might imply thatthis.DataContextwould mean something different.