admin管理员组文章数量:1293313
I am working with DevExpress GridControl using MVVM this is my *.xaml
<dxg:GridControl x:Name="grid" AutoGenerateColumns="AddNew" ShowBorder="True" SelectionMode="Row" DetectNestedPropertyChanges="True" MaxHeight="{x:Static SystemParameters.PrimaryScreenHeight}"
ItemsSource="{Binding Items, Mode=TwoWay}" SelectedItems="{Binding SelectedItems}" CurrentItem="{Binding CurrentItem}" ColumnsSource="{Binding Columns, Mode=TwoWay}" ColumnGeneratorTemplate="{StaticResource DefaultColumnTemplate}"
AllowColumnMRUFilterList="False" AllowLiveDataShaping="True"
>
My Items and columns collection in the VM
public RangeObservableCollection<object> Items
{
get => GetValue<RangeObservableCollection<object>>();
set => SetValue(value);
}
public ObservableCollection<Column> Columns
{
get => GetValue<ObservableCollection<Column>>();
set => SetValue(value);
}
I have a method call that creates a JSON string and Deserializes it
public void CreateCollection()
{
for (int i = 0; i < 100; i++)
{
string json = @"
{
""TagName"": """ + $"TagName{i}" + @""",
""User"": """ + $"User{i}" + @""",
""TagDateTime"": """ + DateTime.UtcNow.ToString("MM-dd-yyyy HH:mm:ss.fff K") + @""",
""" + $"Tag{i}" + @""": """ + $"Value{i}" + @"""
}";
dynamic tag = JsonConvert.DeserializeObject(json)!;
var d = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(json)!;
foreach (var key in d.Keys)
{
var column = new Column(key);
if(!Columns.Contains(column))
Columns.Add(column);
}
Items.Add(tag);
}
}
DataGrid in the application
As shown in the image the data that comes back only displays the first instance of the dynamic data. If I change the order I can verify that. I am trying to display all the data in each column for each row.
本文标签: DevExpress GridControl not showing all data under columns when using dynamic dataStack Overflow
版权声明:本文标题:DevExpress GridControl not showing all data under columns when using dynamic data - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741576452a2386312.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论