【问题标题】:WPF- RadComboBox selected itemWPF- RadComboBox 选定项
【发布时间】:2015-04-17 09:54:24
【问题描述】:

我在我的应用程序中使用RadComboBox,但我无法在控件中设置所选项目,(即)当我单击dropdown 时,列表会向下滑动,当我单击任何项​​目时它没有在ComboBox 中设置。

//XAML:

<telerik:RadRibbonComboBox Name="cmbReports">
    <telerik:RadComboBoxItem Content="Report 1" />
    <telerik:RadComboBoxItem Content="Report 2" />
    <telerik:RadComboBoxItem Content="Report 3" />                                
</telerik:RadRibbonComboBox>

尝试将静态值添加为ComboBoxItem,但它也一样。

我哪里错了?

【问题讨论】:

    标签: wpf xaml telerik


    【解决方案1】:

    尝试直接添加对象,就像我添加字符串一样:

    <telerik:RadRibbonWindow x:Class="Sample.MainWindow"
                         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                         xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                         xmlns:system="clr-namespace:System;assembly=mscorlib"
                         Title="MainWindow"
                         WindowStartupLocation="CenterScreen"
                         WindowState="Maximized">
    
    <telerik:RadRibbonComboBox Name="cmbReports" Width="200" Height="20">
        <system:String>Report1</system:String>
        <system:String>Report2</system:String>
        <system:String>Report3</system:String>
    </telerik:RadRibbonComboBox>
    

    【讨论】:

    • 完美运行。谢谢。但是你不是常规的东西不起作用吗?
    • 因为您要在 RadRibbonComboBox 中添加一个 RadComboBoxItem。您应该添加一个 RadRibbonComboBoxItem 以使其按您期望的方式工作。
    • 谢谢。这就是错误。
    猜你喜欢
    • 2012-11-06
    • 1970-01-01
    • 2011-06-07
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 2011-04-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多