使用滑块从列表中选择一个项目 [英] Use a Slider to select an Item from a list

查看:85
本文介绍了使用滑块从列表中选择一个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含报价的数据库应用程序.每个报价都有一个状态.有5种可能的州,每个报价都分配给一个州,也只有一个州.

I have a database application containing Quotations. Each Quote has a State. There are 5 possible states and each Quote is assigned to one and only one State.

状态是连续的(报价,接受,开始,完成,交付和开票),我想使用滑块控制报价的当前状态.

The States are sequential (Quoted, Accepted, Started, Completed, Delivered and Invoiced) and I would like to use a Slider to control the current State of a Quote.

但是,滑块控件只是表示一个标量,与List或ComboBox控件不同,它没有多个项目或选择的概念.国家不仅是一个标量,而且是一个实体,那么我该如何绑定它呢?我想我需要根据 Slider可以满足我的要求,但我不知道从哪里开始.我直接基于Control类开发了简单的UserControls和其他控件,但是在这里我不胜枚举.

However, the slider control simply represents a scalar and, unlike a List or ComboBox control has no notion of multiple items or selection. The State is an entity not just a scalar, so how do I bind it? I guess I will need to develop a control, based on the Slider, that will do what I want but I've no idea where to start.I have developed simple UserControls and other controls based directly on the Control class, but am out of my depth here.

有人知道吗?

  • 是否已经实现了带有ItemSource和列表绑定支持的Slider?
  • 在创建此类控件时,我可以在哪里寻求指导?
  • Has a Slider with ItemSource and list binding support been implemented already?
  • Where might I go for guidance in creating such a control?

 

 

推荐答案

BigYou,

Hi BigYou,

由于滑块仅具有 Value -属性,因此我将设置其 Minimum / Maximum 以及 SmallChange / LargeChange 属性,以便可能的值范围与您的状态相符,然后使用转换器来来回传递这些值.绑定它们.

since the Slider only has the Value -property, I would set its Minimum /Maximum as well as the SmallChange /LargeChange properties so that the range of possible values is in accordance with your states and then use a converter to transfer the values back and forth resp. bind them.


这篇关于使用滑块从列表中选择一个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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