Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:38:41+00:00 2026-06-13T17:38:41+00:00

I am a C++ developer and I recently moved to C#. I am working

  • 0

I am a C++ developer and I recently moved to C#. I am working on a wpf app using MVVM pattern. I have a groupboxbox in my xaml file which I have divided into two columns. One column contains the dynamically generated set of radiobuttons and other colums contains a label and many comboboxes.

XAML:

<GroupBox Header="Daughter Cards" Height="Auto" HorizontalAlignment="Stretch" Margin="20,5,20,20" Name="groupBox2" VerticalAlignment="Stretch" Width="Auto">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />                        
                    <ColumnDefinition Width="220" />
                </Grid.ColumnDefinitions>

                <Grid Grid.Column="0">
                    <ItemsControl ItemsSource="{Binding SlotChildren}">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <UniformGrid />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>

                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <RadioButton Content="{Binding SlotButtons}" Margin="0,10,0,0" IsChecked="{Binding IsChecked}" GroupName="SlotGroup" Height="15" Width="80" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </Grid>                

                <Grid Grid.Column="1">                        
                        <ComboBox ItemsSource="{Binding DaughterBoardBoxList}" SelectedItem="{Binding SelectedDaughterBoardBoxList, Mode=TwoWay}" SelectedIndex="0" Height="23" HorizontalAlignment="Center" Margin="0" Name="comboBox5" VerticalAlignment="Center" Width="158" />
                        <ComboBox ItemsSource="{Binding DaughterVersionBoxList}" SelectedItem="{Binding SelectedDaughterVersionBoxList, Mode=TwoWay}" SelectedIndex="0" Height="23" HorizontalAlignment="Center" Margin="0" Name="comboBox6" VerticalAlignment="Center" Width="158" />
                        <ComboBox ItemsSource="{Binding DaughterSerialBoxList}" SelectedItem="{Binding SelectedDaughterSerialBoxList, Mode=TwoWay}" SelectedIndex="0" Height="23" HorizontalAlignment="Center" Margin="0" Name="comboBox7" VerticalAlignment="Center" Width="158" />                        
                        <Label Content="{Binding DaughterStatus}" Height="25" HorizontalAlignment="Center" Margin="0" Name="DaughterCardLabel" VerticalAlignment="Center" Width="170" />
                        <ComboBox Height="23" ItemsSource="{Binding I2CAddressList}" SelectedItem="{Binding SelectedI2CAddressList, Mode=TwoWay}" SelectedIndex="0" Grid.Row="0" HorizontalAlignment="Center" Margin="0,0,0,0" Name="comboBox1" VerticalAlignment="Center" Width="200" />
                        <ComboBox Height="23" ItemsSource="{Binding BoardBoxList}" SelectedItem="{Binding SelectedBoardBoxList, Mode=TwoWay}" SelectedIndex="0" Grid.Row="1" HorizontalAlignment="Center" Margin="0,0,0,0" Name="comboBox2" VerticalAlignment="Center" Width="200" />
                        <ComboBox Height="23" ItemsSource="{Binding VersionBoxList}" SelectedItem="{Binding SelectedVersionBoxList, Mode=TwoWay}" SelectedIndex="0" Grid.Row="2" HorizontalAlignment="Center" Margin="0,0,0,0" Name="comboBox3" VerticalAlignment="Center" Width="200" />
                        <ComboBox Height="23" ItemsSource="{Binding SerialBoxList}" SelectedItem="{Binding SelectedSerialBoxList, Mode=TwoWay}" SelectedIndex="0" Grid.Row="3" HorizontalAlignment="Center" Margin="0,0,0,0" Name="comboBox4" VerticalAlignment="Center" Width="200" />                
                </Grid>                                       
            </Grid> 
</GroupBox>

EEPROMViewModel Class: DataContext of xaml is set to this class. In the same class:

Byte[] sendBuf = new Byte[256];
    Byte[] readBuf = new Byte[256];

    public ObservableCollection<EEPROMSlotViewModel> SlotChildren { get; set; }

    public ObservableCollection<string> _I2CAddressList;
    public ObservableCollection<string> _BoardBoxList;
    public ObservableCollection<string> _VersionBoxList;
    public ObservableCollection<string> _SerialBoxList;
    public ObservableCollection<string> _DBoardBoxList;
    public ObservableCollection<string> _DVersionBoxList;
    public ObservableCollection<string> _DSerialBoxList;       

    public EEPROMViewModel()
    {              

        SlotChildren = new ObservableCollection<EEPROMSlotViewModel>();
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "0 : None", ID = 0 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "1 : None", ID = 1 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "2 : None", ID = 2 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "3 : None", ID = 3 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "4 : None", ID = 4 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "5 : None", ID = 5 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "6 : None", ID = 6 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "7 : None", ID = 7 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "8 : None", ID = 8 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "9 : None", ID = 9 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "10 : None", ID = 10 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "11 : None", ID = 11 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "12 : None", ID = 12 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "13 : None", ID = 13 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "14 : None", ID = 14 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "15 : None", ID = 15 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "16 : None", ID = 16 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "17 : None", ID = 17 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "18 : None", ID = 18 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "19 : None", ID = 19 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "20 : None", ID = 20 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "21 : None", ID = 21 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "22 : None", ID = 22 });
        SlotChildren.Add(new EEPROMSlotViewModel() { SlotButtons = "23 : None", ID = 23 });

        var myboard = new[]
        {      
               "",
               "S1010012",   // redhook
               "S1010018",   // bavaria
               "S1010020"    // flying dog
        };

        var myVariant = new[]
        { 
               "",    
               "001A",
               "001B",
               "001C",
               "002A",
               "002B",
               "002C",
               "003A",
               "003B",
               "003C",
        };      

        _I2CAddressList = new ObservableCollection<string>();
        _BoardBoxList = new ObservableCollection<string>(myboard);
        _VersionBoxList = new ObservableCollection<string>(myVariant);
        _SerialBoxList = new ObservableCollection<string>();

        for (int i = 1; i < 200; i++)
        {
            _SerialBoxList.Add(i.ToString());
        }

        //List of I2C Address
        _I2CAddressList.Add("0x50");
        _I2CAddressList.Add("0x53");

        this.SelectedI2CAddressList = this._I2CAddressList[1];
        this.SelectedBoardBoxList = this.BoardBoxList[2];
        this.SelectedVersionBoxList = this.VersionBoxList[2];
        this.SelectedSerialBoxList = this.SerialBoxList[0];                       

        var myDBoards = new[]
        { 
               "",    
               "S1010013",
               "S1010014",
               "S1010015",
               "S1010017",
               "S1010019",
               "S1010021",
               "S1010023",
               "S1010026",
               "S1110029",
        };

        _DBoardBoxList = new ObservableCollection<string>(myDBoards);
        _DVersionBoxList = new ObservableCollection<string>(myVariant);
        _DSerialBoxList = new ObservableCollection<string>();

        for (int j = 1; j < 500; j++)
        {
            _DSerialBoxList.Add(j.ToString());
        }                     

    }              

    public ObservableCollection<string> I2CAddressList
    {
        get { return _I2CAddressList; }
        set
        {
            _I2CAddressList = value;
            OnPropertyChanged("I2CAddressList");
        }
    }

    private string _SelectedI2CAddressList;
    public string SelectedI2CAddressList
    {
        get { return _SelectedI2CAddressList; }
        set
        {
            _SelectedI2CAddressList = value;
            OnPropertyChanged("SelectedI2CAddressList");
        }
    }

    public ObservableCollection<string> BoardBoxList
    {
        get { return _BoardBoxList; }
        set
        {
            _BoardBoxList = value;
            OnPropertyChanged("BoardBoxList");
        }
    }

    private string _SelectedBoardBoxList;
    public string SelectedBoardBoxList
    {
        get { return _SelectedBoardBoxList; }
        set
        {
            _SelectedBoardBoxList = value;
            OnPropertyChanged("SelectedBoardBoxList");
        }
    }

    public ObservableCollection<string> VersionBoxList
    {
        get { return _VersionBoxList; }
        set
        {
            _VersionBoxList = value;
            OnPropertyChanged("VersionBoxList");
        }
    }

    private string _SelectedVersionBoxList;
    public string SelectedVersionBoxList
    {
        get { return _SelectedVersionBoxList; }
        set
        {
            _SelectedVersionBoxList = value;
            OnPropertyChanged("SelectedVersionBoxList");
        }
    }

    public ObservableCollection<string> SerialBoxList
    {
        get { return _SerialBoxList; }
        set
        {
            _SerialBoxList = value;
            OnPropertyChanged("SerialBoxList");
        }
    }

    private string _SelectedSerialBoxList;
    public string SelectedSerialBoxList
    {
        get { return _SelectedSerialBoxList; }
        set
        {
            _SelectedSerialBoxList = value;
            OnPropertyChanged("SelectedSerialBoxList");
        }
    }        

    char[] version = 
        {
                'A', 'U', 'D', 'I', 'E', 'N', 'C', 'E',         // name
                '0', '0', '0', '0', '0', '0', '0', '0' ,        // reserved,  firmware size
                '0', '0', '0', '0', '0', '0', '0', '0' ,        // board number
                '0', '0', '0', '0', '0', '0', '0', '0' ,        // variant, version, serial
                '0', '0', '0', '0', '0', '0', '0', '0'          // date code, reserved
        };        

    public ObservableCollection<string> DaughterBoardBoxList
    {
        get { return _DBoardBoxList; }
        set
        {
            _DBoardBoxList = value;
            OnPropertyChanged("DaughterBoardBoxList");
        }
    }

    public string _SelectedDBoardBoxList;
    public string SelectedDaughterBoardBoxList
    {
        get { return _SelectedDBoardBoxList; }
        set
        {
            _SelectedDBoardBoxList = value;
            OnPropertyChanged("SelectedDaughterBoardBoxList");
        }
    }

    public ObservableCollection<string> DaughterVersionBoxList
    {
        get { return _DVersionBoxList; }
        set
        {
            _DVersionBoxList = value;
            OnPropertyChanged("DaughterVersionBoxList");
        }
    }

    public string _SelectedDVersionBoxList;
    public string SelectedDaughterVersionBoxList
    {
        get { return _SelectedDVersionBoxList; }
        set
        {
            _SelectedDVersionBoxList = value;
            OnPropertyChanged("SelectedDaughterVersionBoxList");
        }
    }

    public ObservableCollection<string> DaughterSerialBoxList
    {
        get { return _DSerialBoxList; }
        set
        {
            _DSerialBoxList = value;
            OnPropertyChanged("DaughterSerialBoxList");
        }
    }

    private string _SelectedDSerialBoxList;
    public string SelectedDaughterSerialBoxList
    {
        get { return _SelectedDSerialBoxList; }
        set
        {
            _SelectedDSerialBoxList = value;
            OnPropertyChanged("SelectedDaughterSerialBoxList");
        }
    }

    private string _DaughterStatus = "Not Retrieved yet";
    public string DaughterStatus
    {
        get { return _DaughterStatus; }
        set
        {
            _DaughterStatus = value;
            OnPropertyChanged("DaughterStatus");
        }
    }          

EEPROMSlotViewModel Class:

EEPROMViewModel mVMModel = new EEPROMViewModel();
private string _SlotButtons;
    public string SlotButtons
    {
        get; set;
    }

    private int _ID;
    public int ID
    {
        get; set;
    }

    private bool _isChecked;
    public bool IsChecked
    {
        get { return _isChecked; }
        set
        {
            _isChecked = value;
            OnSlotClick(ID);
            OnPropertyChanged("IsChecked");
        }
    }

public void OnSlotClick(int Index)
    {
        string label = string.Empty;
        if (Index >= 0 && Index < 24)
        {
            //getShortName(Index, label);
            if (label == string.Empty)
            {
                SlotButtons = Convert.ToString(Index + " : None");
            }
            else
            {
                SlotButtons = Convert.ToString(Index + " :" + label);
            }
        }

        if (label != string.Empty)
        {
            label += " - ";
            //getLongName(Index, label);
        }
        else
        {
            label = "No device found at this slot";
        }

        mVMModel.DaughterStatus = label; // displays it in the label
    }

When I am trying to run the application, it crashes and throws an exception as stackoverflow. The problem seems to be present in EEPROMSlotViewModel when I ccheck any radiobutton and the articular method gets called.

Whats the mistake I am doing here? 🙁
Please help 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:38:42+00:00Added an answer on June 13, 2026 at 5:38 pm

    Your problem is on mVMModel.DaughterStatus = label; // displays it in the label you are probably instantiating EEPROMViewModel class inside EEPROMSlotViewModel which causes infinite loop.

    To solve this you need to access your parentVM it can be done using Interfaces to show only the DaughterStatus but quick answer could be as below :

    Add a property to your EEPROMSlotViewModel :

    public EEPROMViewModel ParentVM
            {
                get { return _parentVm; }
                set
                {
                    _parentVm = value;
                    OnPropertyChanged("ParentVM");
                }
            }
    

    Instead of mVMModel.DaughterStatus = label; put ParentVM.DaughterStatus = label;


    And finally :

    SlotChildren.Add(new EEPROMSlotViewModel() { ParentVM = this, SlotButtons = "0 : None", ID = 0 });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a C++ developer and recently started working on C# WPF app. I
I am a C++ developer and recently moved to C#. I am working on
I recently inherited an iPhone app. The original developer did not understand memory management
I`m an Android developer, and recently started working on JAVA PC project for client.
I've recently been wrestling with an algorithm which was badly implemented (i.e. the developer
I am an android app developer, recently I am trying to learn Marmalade to
I have been an iphone developer for a while, and I have recently been
Myself and another developer on my time recently moved from a Core 2 Duo
I'm a junior developer and recently started working for a very small office where
I have recently moved my VisualSVN Server 2.5.2 to a new machine(from Windows Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.