I have an object with several properties. However some of these properties contain information of the same group so to say. I would like to show these properties in a table in a way that in the same column i could put the properties of the same group. However I am not sure how to do that exactly. I do understand how to do it if i had several objects of the same type (put them in a list and get the default collection view source). But in this case i just have one object with several properties.
My question is: how could I bring these properties together to make one column in datagrid. all the properties are of same datatype (ushort).
Just to illustrate what i mean:
public ushort MyProperty1
{
get{ return myProperty1}
set
{
if(value==myProperty1)
return;
myProperty1=value;
OnPropertyChanged("MyProperty1");
}
}
public ushort MyProperty2
{
get{ return myProperty2}
set
{
if(value==myProperty2)
return;
myProperty2=value;
OnPropertyChanged("MyProperty2");
}
}
public ushort MyProperty3
{
get{ return myProperty3}
set
{
if(value==myProperty3)
return;
myProperty3=value;
OnPropertyChanged("MyProperty3");
}
}
And i would like to show these properties in the same column of datagrid
Thanks :)
You've got a few options to acieve your goal. You could use a
MultiBinding
with aStringFormat
in a standardDataGridTextColumn
.Alternatively, you could define a
DataTemplate
and set it as theCellTemplate
property of aDataGridTemplateColumn
element.I've included links to help get you started.