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
2085
Bind XamGrid Columns to Dictionary property of a custom object
posted

Hello,

I have a custom object which has a dictionary as a property:

public class MyObject

{

string Name {get;set;}

Dictionary<Tuple<string, int, string>, decimal?> MyDictionary {get;set;}

}

I am setting my XamGrid's ItemSource to an ObservableCollection<MyObject> and would like to bind columns in the XamGrid to elements in my Dictionary.

MyXamGrid.Columns.Add(new TextColumn() {Key = <PATH_TO_ACCESS_MyDictionary>, Header = "MyHeader"});

Is this possible?

Parents
No Data
Reply
  • 28945
    Offline posted

    Hello Gary,

    Thank you for following up. Since the Columns collection on the XamGrid is not a dependency property it cannot be bound to. I recommend handling the XamGrid's ColumnAutoGenereated event and add the items to the Dictionary as each new column is generated.

    Let me know if you have any questions regarding this matter.

Children
No Data