zoukankan      html  css  js  c++  java
  • Window8 ComboBox 可编辑

    在win8开发中,用到了comboBox,需要对comboBox可编辑,可是在这个版本中, 不能设置为可编辑。所以只好自定义控件了。以下是刚做好的第一个版本,能对简单操作,要实现双向绑定以及自定义显示的格式,需要在完善代码,具体代码如下:

    ComboboxControl.xaml

    <UserControl>
        <Grid Margin="0,0,0,0">
            <ComboBox x:Name="combobox" Foreground="White"  FontSize="40" />
            <TextBox x:Name="selectValue" Opacity="1" FontSize="40" 
                     Text="{Binding ElementName=combobox,Path=SelectedValue}" Margin="0,0,38,0" />
        </Grid>
    </UserControl>

    ComboboxControl.cs

        public sealed partial class ComboboxControl : UserControl
        {
            public object ItemSourceByCustom { set { combobox.ItemsSource = value; } }
            public ITComboboxControl()
            {
                this.InitializeComponent();
            }
    
            public string GetSelectionValue()
            {
                return selectValue.Text;
            }
        }

    使用

     <controls:ITComboboxControl x:Name="newCombobo" Height="66" Width="352"></controls:ITComboboxControl>

    给数据初始化:

    newCombobo.ItemSourceByCustom = .........ToList();
  • 相关阅读:
    服务器错误日志
    IfcCurveBoundedSurface
    Ifc发展历史与版本介绍
    IfcCurveBoundedPlane
    IfcRationalBSplineSurfaceWithKnots
    IfcBSplineSurfaceWithKnots
    QDateTime QString
    IFC4 标准中的流程实体
    IFC 标准的定义
    MultipartFile
  • 原文地址:https://www.cnblogs.com/bent/p/4546941.html
Copyright © 2011-2022 走看看