使用Silverlight的组合框绑定 [英] Combo box binding using silverlight

查看:93
本文介绍了使用Silverlight的组合框绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,所以我有两个组合框:

Hello guys, so I have two comboboxes:

<ComboBox Height="35" HorizontalAlignment="Left" Margin="343,67,0,0" Name="comboBox2" VerticalAlignment="Top" Width="273" SelectionChanged="comboBox2_SelectionChanged"    >
            <ComboBox.Items>

                <ComboBoxItem IsSelected="True" Content="Trial"  />
                <ComboBoxItem IsSelected="True" Content="Limited" />
                <ComboBoxItem IsSelected="True" Content="Pernament" />




                </ComboBox.Items>
        </ComboBox>








and

<ComboBox Height="35" HorizontalAlignment="Left" Margin="343,125,0,0" Name="comboBox1" VerticalAlignment="Top" Width="273" SelectionChanged="comboBox1_SelectionChanged">
            <ComboBoxItem Content="3 Months" IsSelected="True" />
            <ComboBoxItem Content="6 Months" />
            <ComboBoxItem Content="12 Months" />
            <ComboBoxItem IsSelected="True" Content="-" />
        </ComboBox>




我试图绑定它们,例如,如果第一个框的值不受限,则第二个组合框应被禁用,并且如果在文本框中选择了受限",则必须显示此日期和月份.谢谢您提前提供帮助.




I am trying to bind them for example if value of first box isn''t Limited, second combo box should be disabled, and if Limited is selected in text box this date + months chosen must be displayed. Thanks for help in advance

推荐答案

在这种情况下,您只需要做一件事情,就必须使用IValueConverter:
在Silverlight中使用IValueConverter进行数据绑定 [
There is only onw thing to do in such a case, you will have to use an IValueConverter:
Data Binding Using IValueConverter in Silverlight[^]

You could bind the second combobox to isenabled and do the appropiate convertions from the selected values of the second one :)


这篇关于使用Silverlight的组合框绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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