Silverlight组合框 [英] Silverlight Combobox

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

问题描述

我如何在Silverlight组合框中获取选定的文本?

cmbcomp1 = cmbCountry.SelectedItem.ToString()是我的代码,但不是值,但我得到Prismnew.ServiceReference1.Combo
它没有选择的Text属性
我无法理解您的答案,实际上这是我的Xaml代码
< ComboBox DisplayMemberPath ="Country" x:Name ="cmbCountry" SelectionChanged ="cmbCountry_SelectionChanged" Height ="20" Width ="98" Canvas.Left ="88" Canvas.Top ="8"/>


我想从数据库绑定的组合框中获取选定的文本.
当没有被数据库绑定的组合框正常工作并为我提供选定的文本

how can i get the selected text in combobox of silverlight?

cmbcomp1 =cmbCountry.SelectedItem.ToString () is my code but not value but i get Prismnew.ServiceReference1.Combo
It has no selected Text property
I cant understandur answer actually this is my Xaml code
<ComboBox DisplayMemberPath="Country" x:Name="cmbCountry" SelectionChanged="cmbCountry_SelectionChanged" Height="20" Width="98" Canvas.Left="88" Canvas.Top="8"/>


I want to get selected text from combobox which was binded from database.
when comboboxes not binded by database work as noramal and giving me the selected text

推荐答案

组合框肯定具有Text属性和SelectedText属性吗?您尝试了什么?
Surely the combobox has a Text property, and a SelectedText property ? What have you tried ?


检查要绑定的源.

尝试在组合中使用DataTemplate-

Check the source you are binding to.

Try using a DataTemplate within the combo -

<ComboBox.ItemTemplate><br />
    <DataTemplate><br />
        <TextBlock Text="{Binding myColumn}" /><br />
    </DataTemplate><br />
</ComboBox.ItemTemplate>


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

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