双向EntityCollection绑定到一个二维数据矩阵 [英] Two Way EntityCollection Binding to a Two Dimension Data Matrix

查看:181
本文介绍了双向EntityCollection绑定到一个二维数据矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个日期Strucuture表,它有以下栏目我想显示:

I have a Day Strucuture Table, which has following Columns I want to display:

DoW HoD Value
1   1   1
1   2   2
1   3   2
1   4   2
1   5   2
1   6   2
1   7   2
1   8   2
1   9   2
1   10  2
1   11  4
1   12  4
1   13  4
1   14  4
1   15  4
1   16  4
1   17  4
1   18  4
1   19  4
1   20  4
1   21  1
1   22  1
1   23  1
1   24  1

道琼斯指数周(星期一等)之日起,部门首长是一天中的小时和值是实际值。

Dow is The Day of Week (Monday etc.), HoD is the Hour of Day and Value is the actual value.

现在我要绑定这个日期结构实体集合直接到控制,所以任何的变化可以被绑定的双向

Now I want to Bind this Day Structure Entity Collection directly to a Control so any Changes can be bound TwoWay

筛选格式:

Like this Format:

我认为实现这一目标的最佳途径是使用模板和/或转换器,但我只是不知道如何;)

I think the best way to achieve this is to use a Template and/or a converter, but I just dont know how ;)

我已经阅读这个文章,但缺乏一种双向绑定功能使得它没有用对我来说:(

I already read this article, but Lack of a TwoWay Binding functionality makes it not useful for me :(

我希望你能帮助我。

强尼

推荐答案

我又解决了我自己;)

有关这个问题,我创建了一个网格行和列的固定大写金额。这里面网格我把一个的ItemsControl绑定到我的数据列表。在里面的DataTemplate我把绑定到当前值的文本框和绑定的网格行和Columnproperties到日的周/小时的日子。

For this problem i created a Grid with a fixed amout of rows and columns. Inside this Grid I put a Itemscontrol bound to my List of data. Inside the DataTemplate I placed a Textbox bound to the current value and bound the Grid Row and Columnproperties to the Day of the Week/Hour of Day.

临:
文本框是双向数据绑定到某个对象或元素。
很容易实现,如果行和科拉姆属性是数字。

Pro: The Textbox is TwoWay Databound to a certain Object or Element. Very Easy to implement if Row and Colum Property is numeric.

缺点:
限于行/列的固定大写金额。
非常code在XAML(复制和粘贴)来写
有点脏code。感觉不喜欢这样做的最佳方式。

Con: Limited to a fixed amout of Rows/Columns. Very much Code to write in XAML (Copy and Paste) Kinda "dirty" Code. Feels not like the best way to do it.

我还在打开其他建议。

这篇关于双向EntityCollection绑定到一个二维数据矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆