本文介绍了RibbonComboBox WPF 4.5 C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是初学者,希望得到您的帮助。



在下拉列表中选择的数字不会出现在RibbonComboBox中。我在哪里犯错误?



Hello, I''m beginner here and would like your help.

The number select in dropdown don''t appear in RibbonComboBox. Where I''m making mistakes?

<RibbonWindow

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:Custom="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon" x:Class="RibbonComboBox.MainWindow"

        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Ribbon HorizontalAlignment="Left" VerticalAlignment="Top" Width="517" Height="113" SelectionChanged="Ribbon_SelectionChanged_1">
            <RibbonComboBox x:Name="teste" Label="ComboBox">
                <ComboBoxItem Content="2"/>
                <ComboBoxItem Content="3"/>
                <ComboBoxItem Content="4"/>
            </RibbonComboBox>
        </Ribbon>
</RibbonWindow>

推荐答案

<ribbon:ribboncombobox label="MyRibbon" xmlns:ribbon="#unknown">
                  SelectionBoxWidth="30"
                  VerticalAlignment="Center" 
                  IsEditable="False" >
    <ribbon:ribbongallery selectedvalue="1">
                          SelectedValuePath="Content" 
                          MaxColumnCount="1">
        <ribbon:ribbongallerycategory>
            <ribbon:ribbongalleryitem content="1" foreground="One" />
            <ribbon:ribbongalleryitem content="2" foreground="Two" />
            <ribbon:ribbongalleryitem content="3" foreground="Three" />
        </ribbon:ribbongallerycategory>
    </ribbon:ribbongallery>
</ribbon:ribboncombobox>


这篇关于RibbonComboBox WPF 4.5 C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 23:27