Hi Milan
Please use this as the data source instead of Message:
public Window1()
{
InitializeComponent();
DataTable dt = new DataTable();
DataView dv;
dt.Columns.Add("Display", typeof(string));
dt.Columns.Add("Number", typeof(int));
dt.Rows.Add("show", 1);
dt.Rows.Add("show", 2);
dt.Rows.Add("hide", 3);
dt.Rows.Add("show", 4);
dt.Rows.Add("show", 5);
dv = new DataView(dt);
dv.RowFilter = "Display = 'show'";
RadGridView1.ItemsSource = dv;
}
Change the event as follows:
private void Button_Click(object sender, RoutedEventArgs e)
{
int c;
((DataView)this.RadGridView1.ItemsSource).Table.Rows.Add("show", 5);
c = ((DataView)this.RadGridView1.ItemsSource).Table.Rows.Count;
if (c > 1)
{
var thirdItem = ((IList)this.RadGridView1.ItemsSource)[c-2];
this.RadGridView1.BringDataItemIntoView(thirdItem);
}
}
Run it and give a couple of clicks on the button.
Thanks,
Erez