将复选框绑定到屏幕上的位掩码/标志枚举? [英] Bind checkboxes to bitmask/flags enum on a screen?

查看:97
本文介绍了将复选框绑定到屏幕上的位掩码/标志枚举?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据表,用于存储项目上各种标志的位掩码。  我想在UI上将其显示为每个位的复选框。

I have a data table which stores a bitmask for various flags on an item.  I would like to display this on the UI as a checkbox for each bit.

我正在使用"列表详细信息"屏幕显示所有项目的列表。  当我点击某个项目时,我希望这些复选框能够显示所选项目的位掩码状态。

I'm using a List Detail screen to display a list of all of the items.  When I click an item, I'd like the checkboxes to show the state of the bitmask for the selected item.

 

假设我有一个包含两列的小部件表:Name和Flags。

Let's say I have a widget table with two columns: Name, and Flags.

我创建了一个List and Details屏幕,然后为各种支持的标志添加了三个本地布尔属性(让我们称之为"Custom Paint","Rush Delivery Available"和"Large Item"。  添加本地属性后,我挣扎了一下
将它们添加到Widget Details" Rows Layout"名单。  当我选择它时,添加菜单只有Widget上的现有字段。  我必须将其添加到"详细信息列"中上面,然后我可以将项目拖动到Widget详细信息Rows布局。

I created a List and Details screen, then added three local boolean properties for the various supported flags (let's call them "Custom Paint", "Rush Delivery Available", and "Large Item").  After adding the local properties, I struggled for a bit to add them to the Widget Details "Rows Layout" list.  When I selected it, the Add menu only had existing fields on the Widget.  I had to add it to the "Details Column" above, after which point I could then drag the item to the Widget details Rows layout.

现在我需要自定义代码来转换值。  再次,经过一段时间的努力,我发现有一个_Changed局部方法可以添加到代码窗口(显然在UI中的任何地方都不可用)。  所以我为CustomPaint_Changed添加了三个方法,
RushDeliveryAvailable_Changed和LargeItem_Changed。  这些根据复选框值在widgets.SelectedItem.Flags字段上设置标志。  现在我必须弄清楚如何根据检索到的位掩码初始化复选框值。  
我可以这样做吗?

Now I need custom code to convert values.  Again, after struggling a while I found that there is a _Changed partial method which can be added to the code window (apparently not available anywhere in the UI).  So I added three methods for CustomPaint_Changed, RushDeliveryAvailable_Changed, and LargeItem_Changed.  These set flags on the widgets.SelectedItem.Flags field according to the checkbox value.  Now I have to figure out how to initialize the checkbox values based on the retrieved bitmask.  How can I do that?

问题


  • 为什么我不能直接在"行布局"中添加本地属性。对于项目详细信息项目?
  • 这是因为本地属性实际上是用于屏幕(因而是整个项目列表),而不是个别项目?
  • 为什么不能通过UI访问本地属性的更改事件(或者是他们,我错过了它)?
  • 加载每个数据项时是否有加载事件?  我需要根据小工具表中最初检索的标志数据设置复选框值。
  • 当我双击列表中的小部件时,会弹出一个单独的详细信息窗口。  此窗口具有与列表详细信息屏幕不同的UI(我的复选框不显示)。  如何更改此窗口外观?
  • Why can I not add a local property directly in the "Rows Layout" for the item details item?
  • Is this because the local property is actually for the screen (and thus the whole list of items), rather than an individual item?
  • Why are changed events for local properties not accessible through the UI (or are they, and I missed it)?
  • Is there a load event for when each data item is loaded?  I need to set the checkbox values based on the initially retrieved flag data from the widget table.
  • When I double click a widget in the list, a separate details window pops up.  This window has different UI than the list details screen (my checkboxes do not appear).  How can I change this window appearance?

推荐答案

嗨特拉维斯

我想你是需要一个自定义的Silverlight控件。

I think you're going to need a custom Silverlight control for this.

查看迈克尔华盛顿的学生信息系统教程,特别是第3部分

http://lightswitchhelpwebsite.com/Blog/ tabid / 61 / EntryId / 10 / LightSwitch-Student-Information-System-Part-3-Custom-Controls.aspx

Check out Michael Washington's tutorial for the Student Information System, particularly Part 3 http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/10/LightSwitch-Student-Information-System-Part-3-Custom-Controls.aspx

 

在此,有一个考勤控制,它使用四个单选按钮,最终设置一个字段值。它可能会为您提供bitmasking的起点。

In this, there is an attendance control that uses four radio buttons which ultimately set a single field value. It may give you a starting point for the bitmasking.

问候

保罗

 


这篇关于将复选框绑定到屏幕上的位掩码/标志枚举?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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