This is a migrated thread and some comments may be shown as answers.

[Solved] Is SelectedItem not working out

6 Answers 151 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Paulo
Top achievements
Rank 1
Paulo asked on 15 Mar 2010, 08:33 PM
Hi friends,

I'm trying latest version... for that I did a simple project... a GridView bounded to a List... like this:

<telerikGridView:RadGridView   
       ItemsSource="{Binding Path=GuiaNaoEnviadaDomainService.Data}" 
       IsReadOnly="True" 
       SelectionMode="Single" 
       SelectedItem="{Binding Path=GuiaSelecionada}" 
       AutoGenerateColumns="False" 
       IsBusy="{Binding Path=CarregandoNaoEnviadas}" 
       Width="380" Height="290" d:LayoutOverrides="Width, Height"
       <telerikGridView:RadGridView.Columns> 
       <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Path=Numero}" Header="Número da Guia"/> 
                                            <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Path=Data}" Header="Data" DataFormatString="{} {0:dd, MMM, yyyy}"/> 
                                            <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Path=Paciente.Nome}" Header="Paciente"/> 
                                        </telerikGridView:RadGridView.Columns> 

My problem is, setter of GuiaSelecionada is never called when I navigate rows... Is really something wrong?

6 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 16 Mar 2010, 09:47 AM
Hi Paulo,

Currently there is a limitation which will not allow you to bind SelectedItem that way. You can workaround the limitation by binding the SelectedItem in code:

public MainPage()
{
    InitializeComponent();
  
    this.myGrid.DataLoaded += new System.EventHandler<System.EventArgs>(myGrid_DataLoaded);
}
  
bool selectionInitialized;
  
void myGrid_DataLoaded(object sender, System.EventArgs e)
{
    if (!selectionInitialized)
    {
        Binding binding = new Binding("GuiaSelecionada");
        this.playersGrid.SetBinding(RadGridView.SelectedItemProperty, binding);
        selectionInitialized = true;
    }
}

We will remove the limitation in the near future. Sorry for the inconvenience.

Kind regards,
Milan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Paulo
Top achievements
Rank 1
answered on 11 May 2010, 04:48 PM
Hi!

Some can tell me if that behaviour was fixed?
0
Milan
Telerik team
answered on 11 May 2010, 06:05 PM
Hi Paulo,

This limitation still exists. We will do our best to fix the behavior as soon as possible but it is difficult to provide you with some estimate.


Regards,
Milan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jonathon
Top achievements
Rank 1
answered on 19 Aug 2011, 11:05 PM
Hi,

I was wondering if this has been fixed?

I have SelectedItem bound to an object, but the setter is never getting called.

Thanks,

Jon
0
Maya
Telerik team
answered on 22 Aug 2011, 03:03 PM
Hello Jonathon,

I am sending you a sample project illustrating how you may bind to the SelectedItem property of the grid. Please take a look at it and let me know whether this is the functionality you are looking for.
 

Kind regards,
Maya
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Jonathon
Top achievements
Rank 1
answered on 22 Aug 2011, 07:26 PM
thanks
Tags
GridView
Asked by
Paulo
Top achievements
Rank 1
Answers by
Milan
Telerik team
Paulo
Top achievements
Rank 1
Jonathon
Top achievements
Rank 1
Maya
Telerik team
Share this question
or