This question is locked. New answers and comments are not allowed.
Hello,
I have a RadGridView and one of its columns is a button. In the click of this button i need to identify the object bound to the row of the clicked button. But gridView.CurrentItem just work if the row is selected, i need to identify the item of the row where the button was clicked.
My grid is like the follow:
And this is the handler for the GerarRelatorio event:
What can I do to identify the Ideia object of the row of the clicked button ??
I have a RadGridView and one of its columns is a button. In the click of this button i need to identify the object bound to the row of the clicked button. But gridView.CurrentItem just work if the row is selected, i need to identify the item of the row where the button was clicked.
My grid is like the follow:
| <radGrid:RadGridView Grid.Row="2" CanUserFreezeColumns="False" ColumnsWidthMode="Fill" |
| x:Name="gridIdeias" IsReadOnly="True" AutoGenerateColumns="False"> |
| <radGrid:RadGridView.Columns> |
| <radGrid:GridViewDataColumn HeaderText="Titulo" Width="200" DataMemberPath="Titulo"/> |
| <radGrid:GridViewDataColumn HeaderText="Classificacao" |
| UniqueName="Classificacao" |
| DataMemberBinding="{Binding Classificacao, Mode=OneWay, Converter={StaticResource ConversorDeClassificacao}}" |
| Width="200" DataFormatString="{}{0:g}"> |
| <radGrid:GridViewDataColumn.CellTemplate> |
| <DataTemplate> |
| <ComboBox Background="White" BorderThickness="0" |
| ItemsSource="{Binding Source={StaticResource Conversor}, Path=Values}" |
| SelectionChanged="AvaliacaoRealizadaEvent" |
| SelectedItem="{Binding Classificacao,Mode=OneWay, Converter={StaticResource ConversorDeClassificacao}}"> |
| </ComboBox> |
| </DataTemplate> |
| </radGrid:GridViewDataColumn.CellTemplate> |
| </radGrid:GridViewDataColumn> |
| <radGrid:GridViewDataColumn HeaderText="Avaliacao Geral" Width="200" |
| UniqueName="ColunaAvaliacaoGeral" |
| DataMemberPath="AvaliacaoGeral"> |
| <radGrid:GridViewDataColumn.CellTemplate> |
| <DataTemplate> |
| <HalfStarSelector:StarSelector ReadOnly="True" Height="20" DisplayValue="{Binding AvaliacaoGeral}" |
| Value="{Binding AvaliacaoGeral}" SetDisplayValueOnClick="True" Maximum="5"/> |
| </DataTemplate> |
| </radGrid:GridViewDataColumn.CellTemplate> |
| </radGrid:GridViewDataColumn> |
| <radGrid:GridViewColumn> |
| <radGrid:GridViewColumn.CellTemplate> |
| <DataTemplate> |
| <Button Content="Gerar Relatório" Click="GerarRelatorio" |
| /> |
| </DataTemplate> |
| </radGrid:GridViewColumn.CellTemplate> |
| </radGrid:GridViewColumn> |
| </radGrid:RadGridView.Columns> |
| <radGrid:RadGridView.HierarchyChildTemplate> |
| <DataTemplate> |
| <navigation:RadTabControl Height="100"> |
| <navigation:RadTabItem Header="Descricao"> |
| <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Descricao}" /> |
| </navigation:RadTabItem> |
| <navigation:RadTabItem Header="Justificativa"> |
| <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Justificativa}" /> |
| </navigation:RadTabItem> |
| <navigation:RadTabItem Header="Exemplo"> |
| <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Exemplo}" /> |
| </navigation:RadTabItem> |
| </navigation:RadTabControl> |
| </DataTemplate> |
| </radGrid:RadGridView.HierarchyChildTemplate> |
| </radGrid:RadGridView> |
And this is the handler for the GerarRelatorio event:
| private void GerarRelatorio(object sender, RoutedEventArgs e) |
| { |
| var ideia = (Ideia) gridIdeias.CurrentItem; |
| // The ideia var isnt the Ideia object of the click row when this row is not selected |
| } |
What can I do to identify the Ideia object of the row of the clicked button ??
