Note that there are some explanatory texts on larger screens.

plurals
  1. POTelerik grid selection with a Button - MVVM
    primarykey
    data
    text
    <p>I've got a telerik RadGridView with several rows and columns. One of the columns contain a button, which call a command of my ViewModel.</p> <p>Here's my columns description:</p> <pre><code>&lt;telerikGrid:RadGridView.Columns&gt; &lt;telerikGrid:GridViewColumn Width="32" IsVisible="{Binding IsAvailable}"&gt; &lt;telerikGrid:GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;telerik:RadButton Width="24" Height="24" x:Name="AddItemToList" Command="{Binding AddItemToListCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"&gt; &lt;Image Stretch="Uniform" Source="Images/add.png" HorizontalAlignment="Center" /&gt; &lt;/telerik:RadButton&gt; &lt;/DataTemplate&gt; &lt;/telerikGrid:GridViewColumn.CellTemplate&gt; &lt;/telerikGrid:GridViewColumn&gt; &lt;telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Name}"/&gt; &lt;telerikGrid:GridViewDataColumn DataMemberBinding="{Binding ConName}"/&gt; &lt;telerikGrid:GridViewDataColumn DataMemberBinding="{Binding DisName}"/&gt; &lt;/telerikGrid:RadGridView.Columns&gt; </code></pre> <p></p> <p>When a row is selected and I click on the button, the good values are sent to the ViewModel. But, my problem is that, if I click on the button of another row (not my selected row), it does not select the row and thus, send the wrong values to VM (the value of the selected row is sent)!</p> <p>How do I force the row selection to select the row containing the button I am clicking? It should actually be done in my <code>XAML</code>, before my command is executed.</p> <p>Hope its clear enough. I want my focus to be set on the row containing the button I am clicking.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload