2017-05-02 5 views
0

は、ボタンがセルにバインドされているボタンのクリックで編集したセルを取得する必要があります。私は取得しようとしていますが、まだその最初の行を返します。RadGridView Telerikのセルを選択しなさい

XAML:

<telerik:GridViewDataColumn Header="ABC" DataMemberBinding="{Binding ABC, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" > 
     <telerik:GridViewDataColumn.CellTemplate> 
     <DataTemplate> 
       <TextBlock Visibility="{Binding ABC}">            
       <Hyperlink NavigateUri="{Binding ABC}" RequestNavigate="Hyperlink_RequestNavigate"> 
       <TextBlock Text="Link" />                 
       </Hyperlink>                 
      <telerik:RadRibbonButton Content="Edit" Grid.Column="1" VerticalAlignment="Center" Size="Small" Width="25" 
SmallImage="..\Images\Edit_16.png" LargeImage="..\Images\Edit_32.png" Click="RadButtons_Click"></telerik:RadRibbonButton> 
       </TextBlock>               
     </DataTemplate>              
     </telerik:GridViewDataColumn.CellTemplate> 
</telerik:GridViewDataColumn> 

XAML.cs:私が間違っている

private void RadButtons_Click(object sender, RoutedEventArgs e) 
    {    
      this.grdgetval.CurrentCellInfo // This always returns the first row 
      this.grdgetval.BeginEdit();   
    } 

?何を追加する必要がありますか?

答えて

0

私はあなたが望むものを正確に得ることはありませんが、あなたは、次のいずれかを試みることができる:

this.radGridView1.CurrentCell.ColumnInfo.Name 
this.radGridView1.SelectedRows[0].Cells["Picture Name"].Value 
this.radGridView1.CurrentRow.Cells[0].Value 

私は、これはあなたにいくつかの助けであると思います。

0

あなたがプログラムで編集モードに現在のセルを送信する場合は、次のコードを使用する必要があります - あなたはボタンのクリックでセルを編集したい場合は

this.grdgetval.CurrentCell.BeginEdit() 

を(私はそれがあなたであると仮定

this.grdgetval.CurrentCellInfo = cellToEdit; // cellToEdit-the cell to be edited  
this.grdgetval.BeginEdit(); 

・ホープ、このことができます - の場合)には、以下に示すように、最初のCurrentCellとして所望のセルを設定する必要があります!

+0

CurrentCellはいつも私の最初の行を返します。 – iamCR

関連する問題