ComboBox selected value using MVVM not showing in the display

I have a ComboBox displaying a checkbox and some text.
The combox is bound to a class called SecurityType which has two properties. SecType and IsSelected.

When I select one or more rows I need to get the value of the items selected in the combobox display, instead I see the class bound to the combobox.
The user can select one or more items.

Here is my code


   Model
       public class SecurityType : NotificationObject
    {
     
        public SecurityType(string secType, bool isSelected)
        {
            SecType = secType;          
            IsSelected = isSelected;
         
         
        }
 

        private string _secType;
        public string SecType
        {
            get { return _secType; }
            set
            {
                if (_secType != value)
                {
                    _secType = value;
                    RaisePropertyChanged(() => SecType);
                }
            }
        }

     

        private bool _isSelected;
        public bool IsSelected
        {
            get { return _isSelected; }
            set
            {
                if (_isSelected != value)
                {
                    _isSelected = value;
                    RaisePropertyChanged(() => IsSelected);
                }
            }
        }

    }
   
   
   
   ViewModel
      public class SecurityViewModel : BaseViewModel
    {
        private ObservableCollection<SecurityType> _securitytypeCollection;
        public ObservableCollection<SecurityType> SecurityTypeCollection
        {
            get { return _securitytypeCollection; }
            set
            {
                if (_securitytypeCollection != value)
                {
                    _securitytypeCollection = value;
                    RaisePropertyChanged(() => SecurityTypeCollection);
                }
            }
        }
        SecurityType _selectedSecurityType;
        public SecurityType SelectedSecurityType
        {
            get
            {
                return _selectedSecurityType;
            }
            set
            {
                _selectedSecurityType = value;
                //RaisePropertyChanged(() => SelectedSecurityType);        
               
            }
        }
        public SecurityViewModel()
        {
           GetData();
        }            
      
      XAML
      
      <c1:C1ComboBox Grid.Row="0" Grid.Column="1"  SelectedItem="{Binding SelectedSecurityType, Mode=TwoWay}"  SelectedValuePath="SecType"   ItemsSource="{Binding SecurityTypeCollection}"  >
                                   
                                    <c1:C1ComboBox.ItemTemplate>
                                        <DataTemplate >
                                            <StackPanel Orientation="Horizontal">
                                                <CheckBox IsChecked="{Binding IsSelected}"
                                                        Width="20" />
                                                <TextBlock Text="{Binding SecType}"
                                                         Width="100" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </c1:C1ComboBox.ItemTemplate>
                                </c1:C1ComboBox>
LVL 1
countrymeisterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
no points: I put your code into code blocks Use Code Blocks to make your code easier for othes

Model
 public class SecurityType : NotificationObject
    {
     
        public SecurityType(string secType, bool isSelected)
        {
            SecType = secType;          
            IsSelected = isSelected;
         
         
        }
 

        private string _secType;
        public string SecType
        {
            get { return _secType; }
            set
            {
                if (_secType != value)
                {
                    _secType = value;
                    RaisePropertyChanged(() => SecType);
                }
            }
        }

     

        private bool _isSelected;
        public bool IsSelected
        {
            get { return _isSelected; }
            set
            {
                if (_isSelected != value)
                {
                    _isSelected = value;
                    RaisePropertyChanged(() => IsSelected);
                }
            }
        }

    }

Open in new window


ViewModel

 public class SecurityViewModel : BaseViewModel
    {
        private ObservableCollection<SecurityType> _securitytypeCollection;
        public ObservableCollection<SecurityType> SecurityTypeCollection
        {
            get { return _securitytypeCollection; }
            set
            {
                if (_securitytypeCollection != value)
                {
                    _securitytypeCollection = value;
                    RaisePropertyChanged(() => SecurityTypeCollection);
                }
            }
        }
        SecurityType _selectedSecurityType;
        public SecurityType SelectedSecurityType
        {
            get
            {
                return _selectedSecurityType;
            }
            set
            {
                _selectedSecurityType = value;
                //RaisePropertyChanged(() => SelectedSecurityType);        
               
            }
        }
        public SecurityViewModel()
        {
           GetData();
        }    

Open in new window

Xaml
<c1:C1ComboBox Grid.Row="0" Grid.Column="1"  SelectedItem="{Binding SelectedSecurityType, Mode=TwoWay}"  SelectedValuePath="SecType"   ItemsSource="{Binding SecurityTypeCollection}"  >
                                   
                                    <c1:C1ComboBox.ItemTemplate>
                                        <DataTemplate >
                                            <StackPanel Orientation="Horizontal">
                                                <CheckBox IsChecked="{Binding IsSelected}"
                                                        Width="20" />
                                                <TextBlock Text="{Binding SecType}"
                                                         Width="100" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </c1:C1ComboBox.ItemTemplate>
                                </c1:C1ComboBox> 

Open in new window

0
countrymeisterAuthor Commented:
Is anyone looking into this
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
countrymeisterAuthor Commented:
No one looked into this issue. Very disappointed with th experts.
I eventually found a way to do this
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.