I have a small issue with a dataview and selecting a row while being in edit mode in a cell.
Below is the code-
If I start the below app, double click into one of the visible cells and than press on the
"ClickMe" button, the RowFilter is changed by code, the last line become visible, however
it is not selected even due I try to do so.
If I press again on the button, the row is then selected.
Any ideas ?
Thanks,
Erez
P.S: "RadControls for WPF Q1 2009 SP2"
<Window x:Class="WpfToTelerikForum.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="333" Width="639" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<StackPanel Orientation="Vertical">
<telerik:RadGridView Margin="12,20,-12,-20"
Name="radGridView1"
Loaded="radGridView1_Loaded" />
<Button Margin="8" Height="50" Width="50" Content="ClickMe" Click="Button_Click"/>
</StackPanel>
</Window>
using System;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Data;
namespace WpfToTelerikForum
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void radGridView1_Loaded(object sender, RoutedEventArgs e)
{
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);
dv = new DataView(dt);
dv.RowFilter = "Display = 'show'";
radGridView1.ItemsSource = dv;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
DataTable dt;
DataView dv;
dv = ((DataView)radGridView1.ItemsSource);
dt = dv.Table;
dt.Rows[dt.Rows.Count-1]["Display"] = "show";
radGridView1.Records[radGridView1.Records.Count-1].IsSelected = true;
}
}
}