Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
How to create a dynamic amount of columns at runtime for a xamdatagrid?
posted

I want to create a xamDataGrid for a ViewModel which has a list of "parameter"s, this kind of "parameter" is read from the database, so I have no idea how many parameters there will be. In that case, I cant directly create property for them in the ViewModel. My ViewModel is like this:

public class MyViewModel

{

public string Name{get;set;}

public List<Parameter> Parameters{get;set;}

}

public class Parameter

{

public string ParameterName{get;set;}

public string Value{get;set;}

}

I want these parameters to be columns as same as the "Name" of "MyViewModel".

Is this approach ok without violating the MVVm pattern? Thanks