Note that there are some explanatory texts on larger screens.

plurals
  1. POsilverlight MVVM retrieve datagrid selected rows on radioBox selection
    primarykey
    data
    text
    <p>I have a dialogBox populates Grid Row , i want to selected particular Grid Row data on radio Button selection in ViewModel</p> <p>Here is my Xaml</p> <pre><code>&lt;cc:DialogBase xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="LMS.Client.View.CampaignSearchResultsDialog" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:cc="clr-namespace:LMS.Client.View;assembly=LMS.Client.Common" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400" xmlns:attach="clr-namespace:LMS.Client.Model.ViewModels.AttachedProperties;assembly=LMS.Client.Model" xmlns:converter="clr-namespace:LMS.Client.Model.ViewModels.Converters;assembly=LMS.Client.Model" xmlns:model="clr-namespace:LMS.Client.Model;assembly=LMS.Client.Common"&gt; &lt;cc:DialogBase.Resources&gt; &lt;converter:DataContextFinderFromControl x:Key="dataContextFinder"/&gt; &lt;model:ViewModelSource Source="{Binding}" x:Name="viewModel"/&gt; &lt;/cc:DialogBase.Resources&gt; &lt;Grid x:Name="LayoutRoot" Background="White" Height="300" Width="600"&gt; &lt;sdk:DataGrid AutoGenerateColumns="False" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding Path=Leads}" SelectedItem="{Binding Path=SelectedLead,Mode=TwoWay}" Name="dgSearchResult" Style="{StaticResource DataGridStyle}"&gt; &lt;sdk:DataGrid.Columns&gt; &lt;sdk:DataGridTemplateColumn Header="Select"&gt; &lt;sdk:DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;RadioButton Content="Test" Style="{StaticResource SemiRadioButtonStyle}" GroupName="Lead" IsEnabled="True" Command="{Binding Path= CheckedCommand}" IsChecked="{Binding InboundChecked,Mode=TwoWay}"/&gt; &lt;/DataTemplate&gt; &lt;/sdk:DataGridTemplateColumn.CellTemplate&gt; &lt;/sdk:DataGridTemplateColumn&gt; &lt;/sdk:DataGrid&gt; &lt;StackPanel Width="300" Height="50" Background="White"&gt; &lt;Grid Height="50"&gt; &lt;/Grid&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/cc:DialogBase&gt; </code></pre> <p>and the ViewModel</p> <pre><code>using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Collections.Generic; using LMS.Server.DataAccess; using System.Collections.ObjectModel; using LMS.Client.Commanding; using System.ComponentModel; namespace LMS.Client.Model { public class CampaignSearchResultsViewModel : ViewModelBase { public CampaignSearchResultsViewModel(List&lt;Lead&gt; obj) { foreach(Lead lead in obj) { SelectedLead = lead; } } public CampaignSearchResultsViewModel() { this.Commands.Add("CheckedCommand", new ActionCommand&lt;Lead&gt;(CheckIt)); _leads = new ObservableCollection&lt;Lead&gt;(); // this.icv=System.Windows.Data.CollectionViewSource.SourceProperty(_leads); //_leads.Add(new Lead { FirstName = "Neeraj", LastName = "Verma" }); //_leads.Add(new Lead { FirstName = "Tarun", LastName = "Singh" }); } private void CheckIt(Lead lead) { SelectedLead = lead; LeadViewModel lmv = new LeadViewModel(this); var x = SelectedLead; CampaignSearchResultsViewModel vm = new CampaignSearchResultsViewModel(); } #region Private private ObservableCollection&lt;Lead&gt; _leads; public bool IsChecked { get; set; } private ICommand _checkedCommand; private object _testProperty; private Lead _selectedLead; private ICollectionView icv; #endregion private ICommand _checkedRadioCommand; private bool _inboundChecked; #region Properties public ObservableCollection&lt;Lead&gt; Leads { get { return _leads; } set { _leads = value; FirePropertyChanged("Leads"); } } public Lead SelectedLead { get { return _selectedLead; } set { _selectedLead = value; } } public ICommand CheckedCommand { get { return Commands["CheckedCommand"]; } } public bool InboundChecked { get { return _inboundChecked; } private set { if (_inboundChecked != value) { _inboundChecked = value; FirePropertyChanged("InboundChecked"); } } } #endregion } } </code></pre> <p>I cant able to map data in the Grid on radio Button, Please tell me where I am missing</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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