mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
Exposed list properties on KComboBox
This commit is contained in:
parent
ed1892b3d7
commit
72fa30189e
@ -18,6 +18,29 @@ namespace Acacia.Controls
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
override public bool AutoSize { get { return base.AutoSize; } set { base.AutoSize = value; } }
|
||||
|
||||
[Category("Appearance")]
|
||||
[Localizable(true)]
|
||||
public string Placeholder
|
||||
{
|
||||
get { return _edit.Placeholder; }
|
||||
set { _edit.Placeholder = value; }
|
||||
}
|
||||
|
||||
[Category("Appearance")]
|
||||
public Color PlaceholderColor
|
||||
{
|
||||
get { return _edit.PlaceholderColor; }
|
||||
set { _edit.PlaceholderColor = value; }
|
||||
}
|
||||
|
||||
[Category("Appearance")]
|
||||
public Font PlaceholderFont
|
||||
{
|
||||
get { return _edit.PlaceholderFont; }
|
||||
set { _edit.PlaceholderFont = value; }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Components
|
||||
@ -35,7 +58,6 @@ namespace Acacia.Controls
|
||||
|
||||
_edit = new KTextBox();
|
||||
_edit.BorderStyle = BorderStyle.None;
|
||||
_edit.Placeholder = "Test";
|
||||
Controls.Add(_edit);
|
||||
_state.AddControl(_edit);
|
||||
_edit.TextChanged += _edit_TextChanged;
|
||||
@ -198,6 +220,7 @@ namespace Acacia.Controls
|
||||
this._edit.Focus();
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool DroppedDown
|
||||
{
|
||||
get
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -10,37 +12,64 @@ namespace Acacia.Controls
|
||||
{
|
||||
public class KComboBox : KAbstractComboBox
|
||||
{
|
||||
private readonly ListBox _dropList;
|
||||
private readonly ListBox _list;
|
||||
|
||||
#region Items properties
|
||||
|
||||
[DefaultValue(true)]
|
||||
[Localizable(true)]
|
||||
[Category("Behavior")]
|
||||
public bool IntegralHeight { get { return _list.IntegralHeight; } set { _list.IntegralHeight = value; } }
|
||||
|
||||
[DefaultValue(13)]
|
||||
[Localizable(true)]
|
||||
[Category("Behavior")]
|
||||
public int ItemHeight { get { return _list.ItemHeight; } set { _list.ItemHeight = value; } }
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
|
||||
[Localizable(true)]
|
||||
[MergableProperty(false)]
|
||||
[Category("Behavior")]
|
||||
public ListBox.ObjectCollection Items { get { return _list.Items; } }
|
||||
|
||||
[DefaultValue(8)]
|
||||
[Localizable(true)]
|
||||
[Category("Behavior")]
|
||||
public int MaxDropDownItems { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public KComboBox()
|
||||
{
|
||||
_dropList = new ListBox();
|
||||
_dropList.IntegralHeight = true;
|
||||
DropControl = _dropList;
|
||||
_dropList.DisplayMember = "DisplayName"; // TODO: remove from here
|
||||
MaxDropDownItems = 8;
|
||||
_list = new ListBox();
|
||||
_list.IntegralHeight = true;
|
||||
DropControl = _list;
|
||||
_list.DisplayMember = "DisplayName"; // TODO: remove from here
|
||||
}
|
||||
|
||||
public void BeginUpdate()
|
||||
{
|
||||
_dropList.BeginUpdate();
|
||||
_list.BeginUpdate();
|
||||
}
|
||||
|
||||
public void EndUpdate()
|
||||
{
|
||||
_dropList.EndUpdate();
|
||||
_list.EndUpdate();
|
||||
}
|
||||
|
||||
public object DataSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dropList.DataSource;
|
||||
return _list.DataSource;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_dropList.BindingContext = new BindingContext();
|
||||
_dropList.DataSource = value;
|
||||
_list.BindingContext = new BindingContext();
|
||||
_list.DataSource = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user