I have an Entry
class, through which i want to expose data to a Gridview in WPF (via an List<Entry>
). I need to have a column in the Gridview for every property of the Entry
object (also get one column for every entry of propsA3
), but I am uncertain how to define the getter/setter methods for the array in order to always get/set the properties of the underlying data.
public Entry
{
private ObjA oA;
private ObjB[] listB;
public int PropA1 {get {return oA.Prop1;} set {oA.Prop1 = value;}}
public int PropA2 {get {return oA.Prop2;} set {oA.Prop1 = value;}}
public int[] propsA3;
}
public ObjA
{
public int Prop1 {get, set};
public int Prop2 {get, set};
public int getVal3(ObjB b) {return calSomethin(b);}
public int setVal3(ref ObjB b, int val) { /*do something to ObjB*/}
}
public ObjB
{
Byte[] data;
}
What I want for PropsA3
have a get/set behavior of the following:
Entry e;
Get:
int a = e.propsA3[i];
=> a = oA.getVal3(listB[i])
;
Set:
e.propsA3[i] = 5;
=> oA.setVal3(listB[i], val)
;
Is this possible? How can achieve this or how do I have to change the class design to get the desired result?