Binding Datagrid 'ItemsSource' to a list of ExpandoObject results in no data being shown #18209
Unanswered
fede-marsiglia
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all! My app query a SQL database for a preview of the first 10 rows in a table, that I want to display in a Datagrid. As the data can come from any table in the schema, I cannot instantiate a fixed object but need an ExpandoObject to which I add properties as needed (depending on how many columns the specified SQL table has).
Unfortunately, binding the 'ItemsSource' property of the Datagrid results in no data shown. I already looked at this old issue, and tried the same approach, but the added plugin does not even get triggered even though the ExpandoObjects are correctly populated. The plugin is triggered when trying to bind to a fixed or dynamic object though.
Some code for context:
STEP 1: data querying
STEP 2: The result is passed as the content of the ObservableCollection in the following object:
STEP 3: the above result is set as the target for the following Binding:
doing the steps above with a list of fixed, or even dynamic objects result in the data being shown correctly, so I am quite sure the problem lies in how Avalonia handles ExpandoObjects specifically. Hope you can help me, and thanks in advance to those that will try to help!
Beta Was this translation helpful? Give feedback.
All reactions