提问人:Geoff 提问时间:11/10/2023 更新时间:11/10/2023 访问量:36
WPF UI 设计问题:如何以结构化方式表示来自单个复杂对象的数据
WPF UI Design Question: How to represent data in a structured way from a single complex object
问:
WPF 菜鸟在这里...
我想就如何以结构化、易于理解的方式向用户呈现数据提供一些建议。我的数据来自一个大型 JSON 字符串,该字符串被解析为一个相当复杂的对象。该对象主要由各种单独的字符串和数组组成,这些字符串和数组以相当分层的模式构建。
以下是我正在使用的内容(请注意,嵌套的 []s 会继续进行几层):
public class MyBigFatModel
{
[JsonProperty("pattern")]
public Pattern pattern { get; set; }
[JsonProperty("fingerprint")]
public string Fingerprint { get; set; }
public partial class Pattern
{
[JsonProperty("uuid")]
public string Uuid { get; set; }
[JsonProperty("created")]
public DateTime Created { get; set; }
[JsonProperty("modified")]
public object Modified { get; set; }
[JsonProperty("info")]
public Info Info { get; set; }
[JsonProperty("holeTemplates")]
public HoleTemplate[] HoleTemplates { get; set; }
[JsonProperty("thingy")]
public Thingy Thingy { get; set; }
}
public partial class Thingy
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("thingyW")]
public ThingyW ThingyW { get; set; }
[JsonProperty("encoder")]
public Encoder Encoder { get; set; }
[JsonProperty("customer")]
public string Customer { get; set; }
[JsonProperty("location")]
public string Location { get; set; }
[JsonProperty("comment")]
public string Comment { get; set; }
}
public partial class ThingyW
{
[JsonProperty("NameDesc1")]
public string NameDesc1 { get; set; }
[JsonProperty("NameDesc2")]
[JsonConverter(typeof(ParseStringConverter))]
public long BNameDesc2 { get; set; }
...
[JsonProperty("serialNo")]
public string SerialNo { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
[JsonProperty("battLevel")]
public long BattLevel { get; set; }
[JsonProperty("fileUUID")]
public string FileUuid { get; set; }
[JsonProperty("pcUUID")]
public string PcUuid { get; set; }
}
public partial class Encoder
{
[JsonProperty("line1")]
public string Line1 { get; set; }
[JsonProperty("line2")]
public string Line2 { get; set; }
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("serialNo")]
public object SerialNo { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
[JsonProperty("battLevel")]
public long BattLevel { get; set; }
[JsonProperty("state")]
public string State { get; set; }
[JsonProperty("timestamp")]
public DateTime Timestamp { get; set; }
[JsonProperty("expiry")]
public DateTime Expiry { get; set; }
[JsonProperty("validationKey")]
public string ValidationKey { get; set; }
[JsonProperty("standoffSeconds")]
public long StandoffSeconds { get; set; }
[JsonProperty("beaconID")]
public string BeaconId { get; set; }
[JsonProperty("aTime")]
public DateTime ATime { get; set; }
[JsonProperty("fTime")]
public DateTime FTime { get; set; }
[JsonProperty("codes")]
public Code[] Codes { get; set; }
[JsonProperty("holes")]
public Hole[] Holes { get; set; }
[JsonProperty("availableUID")]
public string[] AvailableUid { get; set; }
}
最初我想使用 TreeView,但据我所知,它只绑定到集合,而不是单个对象。
关于如何以分层方式表示此数据以允许用户钻取数据的任何建议?
我仍然对使用 Treeview 持开放态度,但我有限的理解会让我认为我需要将对象拆开并创建一堆我可以将树指向的新集合。
任何想法、建议等将不胜感激!
答: 暂无答案
评论
new[] { myItem }