I have a dataGrid that I want to add rows with a button press. But when the button is pressed. No data is seen in the dataGrid. In fact. Nothing is visible in dataGrid. How can I solve this issue?
public sealed partial class MainPage : Page
{
DataTable table = new DataTable();
public MainPage()
{
this.InitializeComponent();
table.Columns.Add("title", typeof(string));
table.Columns.Add("message", typeof(string));
noteList.AutoGenerateColumns = false;
noteList.ItemsSource = table.DefaultView;
}
private void bNew_Click(object sender, RoutedEventArgs e)
{
table.Rows.Add("Hello", "Hi");
}
}