123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace FastReport.Dialog
- {
- /// <summary>
- /// Represents a Windows control to display a list of items.
- /// Wraps the <see cref="System.Windows.Forms.ListBox"/> control.
- /// </summary>
- public class ListBoxControl : ListBoxBaseControl
- {
- private ListBox listBox;
- #region Properties
- /// <summary>
- /// Gets an internal <b>ListBox</b>.
- /// </summary>
- [Browsable(false)]
- public ListBox ListBox
- {
- get { return listBox; }
- }
- #endregion
- #region Protected Methods
- /// <inheritdoc/>
- protected override object GetValue()
- {
- List<string> list = new List<string>();
- foreach (object item in SelectedItems)
- {
- list.Add((string)item);
- }
- return list.ToArray();
- }
- #endregion
- #region Public Methods
- /// <inheritdoc/>
- public override void OnSelectedIndexChanged(EventArgs e)
- {
- OnFilterChanged();
- base.OnSelectedIndexChanged(e);
- }
- #endregion
- /// <summary>
- /// Initializes a new instance of the <b>ListBoxControl</b> class with default settings.
- /// </summary>
- public ListBoxControl()
- {
- listBox = new ListBox();
- Control = listBox;
- ListBox.IntegralHeight = false;
- BindableProperty = this.GetType().GetProperty("SelectedItem");
- }
- }
- }
|