1

I need some help on a little problem; I want to use a component which inherits from a RadGridView from Telerik.
I want to fill it with a BindingList of RowService, a class I create, the code looks like this :

public class RowService
    {
        public String ServiceName { get; set; }
        public String Description { get; set; }
        public ServiceControllerStatus ServiceStatus { get; set; }
        public String State { get; set; }
        public ServiceStartModeEx StartMode { get; set; }
        public String StartType { get; set; }
        public String StartName { get; set; }
        public String PathName { get; set; }
        public String Version { get; set; }
        public String NewVersion { get; set; }
    }

The columns have the same name as the attributes of this class.
I add my differents RowService in a BindingList called bSourceServices. When I try to associate it to my grid with the following line, the grid stay empty :

plkUcGridView1.DataSource = bSourceServices;
Here is a picture of what I obtain
My grid is empty, even if bSourceServices isn't (I checked with a foreach and it contains what it should contains, the list isn't empty).

Thanks to anyone who would help me understand this problem !

lvbartow
  • 41
  • 6
  • You should have your list as a data member of a view model calss which inherit from INotifyPropertyChanged and then call the event NotifyPropertyChanged passing the name of the data memeber – Marco Beninca May 02 '22 at 10:20
  • @MarcoBeninca Thanks for your answern burI think i don't really understand what you mean... I'm not really used to C#, I found another way to achieve what i wanted to do, but if you have time I'll appreciate any precision or example. – lvbartow May 02 '22 at 16:09
  • It's a long story about model-view-viewmodel design pattern... have a read on the following [article](https://learn.microsoft.com/en-us/archive/msdn-magazine/2009/february/patterns-wpf-apps-with-the-model-view-viewmodel-design-pattern) – Marco Beninca May 03 '22 at 07:13
  • @MarcoBeninca thanks ! gonna read it when i'll have some time. I knew the MVC pattern, but not MVVM ! – lvbartow May 03 '22 at 09:31

1 Answers1

0

Found the way to achieve what i wanted to do :
i just needed to complete the empty field "FieldName" with the name of the attribute of my object.

Now, it works great with myGridView.DataSource = myListOfObjects.
Thanks !

lvbartow
  • 41
  • 6