This commit is contained in:
Desislava Yordanova 2021-06-02 16:31:40 +03:00
Родитель 085dd9a063
Коммит 7e5c0c73ac
31 изменённых файлов: 1909 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using Telerik.WinControls;
using Telerik.WinControls.UI;
namespace MultiSelectDropDown
{
public class CustomDropDownList : RadDropDownList
{
public override string ThemeClassName
{
get
{
return typeof(RadDropDownList).FullName;
}
set
{
}
}
protected override RadDropDownListElement CreateDropDownListElement()
{
return new CustomEditorElement();
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Editor(typeof(CustomListControlCollectionEditor), typeof(UITypeEditor)),
Category(RadDesignCategory.DataCategory)]
[Description("Gets a collection representing the items contained in this RadDropDownList.")]
public new RadListDataItemCollection Items
{
get
{
return base.Items;
}
}
}
public class CustomListControlCollectionEditor : Telerik.WinControls.UI.Design.RadListControlCollectionEditor
{
public CustomListControlCollectionEditor(Type itemType) : base(itemType)
{
}
protected override Type[] CreateNewItemTypes()
{
Type[] baseTypes = base.CreateNewItemTypes();
Type[] newTypes = new Type[baseTypes.Length + 1];
baseTypes.CopyTo(newTypes, 0);
newTypes[baseTypes.Length] = typeof(CustomListDataItem);
return newTypes;
}
}
}

Просмотреть файл

@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.WinControls.UI;
using Telerik.WinControls.Layouts;
using Telerik.WinControls;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
namespace MultiSelectDropDown
{
public class CustomEditorElement : RadDropDownListEditorElement
{
private LightVisualElement customText;
private RadButtonElement closeButton;
private bool textChanged;
public CustomEditorElement()
{
closeButton = new RadButtonElement("Close");
closeButton.SetValue(DockLayoutPanel.DockProperty, Dock.Bottom);
closeButton.Click += new EventHandler(closeButton_Click);
this.Popup.SizingGripDockLayout.Children.Insert(1, closeButton);
this.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.PopupClosing += new RadPopupClosingEventHandler(CustomEditorElement_PopupClosing);
this.CreatingVisualItem += new CreatingVisualListItemEventHandler(CustomEditorElement_CreatingVisualItem);
this.ListElement.ItemDataBinding += this.CustomEditorElement_ItemDataBinding;
}
private void deselectAll_Click(object sender, EventArgs e)
{
this.SetItemsCheckSelect(false);
}
private void selectAll_Click(object sender, EventArgs e)
{
this.SetItemsCheckSelect(true);
}
private void SetItemsCheckSelect(bool value)
{
foreach (CustomListDataItem item in this.Items)
{
item.Selected = value;
item.Checked = value;
}
this.SynchronizeText();
}
protected override void SyncVisualProperties(RadListDataItem listItem)
{
}
void closeButton_Click(object sender, EventArgs e)
{
ClosePopup();
GridDataCellElement cell = this.Parent as GridDataCellElement;
if (cell != null)
{
cell.GridViewElement.EndEdit();
}
}
private void CustomEditorElement_ItemDataBinding(object sender, ListItemDataBindingEventArgs args)
{
args.NewItem = new CustomListDataItem();
}
void CustomEditorElement_CreatingVisualItem(object sender, CreatingVisualListItemEventArgs args)
{
args.VisualItem = new CustomListVisualItem();
}
void CustomEditorElement_PopupClosing(object sender, RadPopupClosingEventArgs args)
{
CustomEditorElement editor = (CustomEditorElement)sender;
if (args.CloseReason == RadPopupCloseReason.Mouse)
{
if (editor.PopupForm.Bounds.Contains(Control.MousePosition))
{
args.Cancel = true;
}
}
}
protected override void CreateChildElements()
{
base.CreateChildElements();
customText = new LightVisualElement();
customText.DrawBorder = false;
customText.DrawFill = true;
customText.GradientStyle = GradientStyles.Solid;
customText.BackColor = Color.White;
customText.TextAlignment = ContentAlignment.MiddleLeft;
this.EditableElement.Children.Add(customText);
this.TextBox.Visibility = ElementVisibility.Collapsed;
this.MinSize = new Size(0, 21);
}
public override void ShowPopup()
{
bool[] selected = new bool[this.Items.Count];
for (int i = 0; i < selected.Length; i++)
{
selected[i] = this.Items[i].Selected;
}
base.ShowPopup();
for (int i = 0; i < selected.Length; i++)
{
this.Items[i].Selected = selected[i];
}
}
protected override void OnTextChanged(EventArgs e)
{
SynchronizeText();
}
internal void SynchronizeText()
{
if (textChanged)
{
return;
}
textChanged = true;
StringBuilder text = new StringBuilder();
foreach (CustomListDataItem item in this.ListElement.Items)
{
if (item.Checked)
{
text.AppendFormat("{0}; ", item.Text);
}
}
customText.Text = text.ToString();
textChanged = false;
}
}
}

Просмотреть файл

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.WinControls.UI;
using Telerik.WinControls;
using System.ComponentModel;
namespace MultiSelectDropDown
{
public class CustomListDataItem : RadListDataItem
{
#region RadProperties
public static readonly RadProperty CheckedProperty = RadProperty.Register("Checked", typeof(bool), typeof(CustomListDataItem), new RadElementPropertyMetadata(false));
#endregion
#region Properties
public bool Checked
{
get
{
return (bool)this.GetValue(CustomListDataItem.CheckedProperty);
}
set
{
this.SetValue(CustomListDataItem.CheckedProperty, value);
}
}
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
{
base.OnPropertyChanged(e);
}
#endregion
#region Overrides
protected override void SetDataBoundItem(bool dataBinding, object value)
{
base.SetDataBoundItem(dataBinding, value);
if (value is INotifyPropertyChanged)
{
INotifyPropertyChanged item = value as INotifyPropertyChanged;
item.PropertyChanged += item_PropertyChanged;
}
}
#endregion
#region Private Methods
private void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "Checked")
{
this.Checked = (this.DataBoundItem as RadListDataItem).Selected;
}
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.WinControls.UI;
using System.Windows.Forms;
using System.Drawing;
using Telerik.WinControls.Enumerations;
namespace MultiSelectDropDown
{
public class CustomListVisualItem : RadListVisualItem
{
private RadCheckBoxElement checkbox;
private LightVisualElement content;
protected override void CreateChildElements()
{
base.CreateChildElements();
StackLayoutElement stack = new StackLayoutElement();
stack.Orientation = Orientation.Horizontal;
this.Children.Add(stack);
checkbox = new RadCheckBoxElement();
checkbox.ToggleStateChanged += new StateChangedEventHandler(checkbox_ToggleStateChanged);
stack.Children.Add(checkbox);
content = new LightVisualElement();
content.StretchHorizontally = false;
content.StretchVertically = true;
content.TextAlignment = ContentAlignment.MiddleLeft;
content.NotifyParentOnMouseInput = true;
stack.Children.Add(content);
}
void checkbox_ToggleStateChanged(object sender, StateChangedEventArgs e)
{
((CustomListDataItem)this.Data).Checked = this.checkbox.Checked;
DropDownPopupForm form = this.ElementTree.Control as DropDownPopupForm;
((CustomEditorElement)form.OwnerDropDownListElement).SynchronizeText();
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadListVisualItem);
}
}
protected override void SynchronizeProperties()
{
base.SynchronizeProperties();
checkbox.IsChecked = this.Data.Selected;
this.content.Text = this.Data.Text;
this.Text = "";
}
}
}

Просмотреть файл

@ -0,0 +1,94 @@
namespace MultiSelectDropDown
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
MultiSelectDropDown.CustomListDataItem customListDataItem1 = new MultiSelectDropDown.CustomListDataItem();
MultiSelectDropDown.CustomListDataItem customListDataItem2 = new MultiSelectDropDown.CustomListDataItem();
MultiSelectDropDown.CustomListDataItem customListDataItem3 = new MultiSelectDropDown.CustomListDataItem();
MultiSelectDropDown.CustomListDataItem customListDataItem4 = new MultiSelectDropDown.CustomListDataItem();
this.customDropDownList1 = new MultiSelectDropDown.CustomDropDownList();
this.radLabel1 = new Telerik.WinControls.UI.RadLabel();
((System.ComponentModel.ISupportInitialize)(this.customDropDownList1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel1)).BeginInit();
this.SuspendLayout();
//
// customDropDownList1
//
customListDataItem1.Text = "ListItem 1";
customListDataItem1.TextWrap = true;
customListDataItem2.Text = "ListItem 2";
customListDataItem2.TextWrap = true;
customListDataItem3.Text = "ListItem 3";
customListDataItem3.TextWrap = true;
customListDataItem4.Text = "ListItem 4";
customListDataItem4.TextWrap = true;
this.customDropDownList1.Items.Add(customListDataItem1);
this.customDropDownList1.Items.Add(customListDataItem2);
this.customDropDownList1.Items.Add(customListDataItem3);
this.customDropDownList1.Items.Add(customListDataItem4);
this.customDropDownList1.Location = new System.Drawing.Point(128, 184);
this.customDropDownList1.Name = "customDropDownList1";
this.customDropDownList1.Size = new System.Drawing.Size(233, 21);
this.customDropDownList1.TabIndex = 0;
//
// radLabel1
//
this.radLabel1.Location = new System.Drawing.Point(13, 184);
this.radLabel1.Name = "radLabel1";
this.radLabel1.Size = new System.Drawing.Size(101, 18);
this.radLabel1.TabIndex = 1;
this.radLabel1.Text = "Added design time";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(400, 400);
this.Controls.Add(this.radLabel1);
this.Controls.Add(this.customDropDownList1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.customDropDownList1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private CustomDropDownList customDropDownList1;
private Telerik.WinControls.UI.RadLabel radLabel1;
}
}

Просмотреть файл

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls.UI;
using Telerik.WinControls;
namespace MultiSelectDropDown
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DataTable t = new DataTable();
t.Columns.Add("ID", typeof(int));
t.Columns.Add("Name", typeof(string));
t.Rows.Add(1, "one");
t.Rows.Add(2, "two");
t.Rows.Add(3, "three");
t.Rows.Add(4, "four");
t.Rows.Add(5, "five");
t.Rows.Add(6, "six");
t.Rows.Add(7, "seven");
t.Rows.Add(8, "eight");
t.Rows.Add(9, "nine");
t.Rows.Add(10, "ten");
CustomDropDownList list = new CustomDropDownList();
list.Name = "MyDropDown";
list.Location = new Point(130, 80);
list.Size = new System.Drawing.Size(230, 20);
Controls.Add(list);
list.DisplayMember = "Name";
list.ValueMember = "ID";
list.DataSource = t;
list.SelectedIndexChanged += list_SelectedIndexChanged;
}
private void list_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
if (e.Position > -1)
{
CustomDropDownList list = sender as CustomDropDownList;
((CustomListDataItem)list.Items[e.Position]).Checked = true;
((CustomEditorElement)list.DropDownListElement).SynchronizeText();
}
}
private void Form1_Load(object sender, EventArgs e)
{
CustomDropDownList ddl = this.Controls["MyDropDown"] as CustomDropDownList;
((CustomListDataItem)ddl.DropDownListElement.ListElement.SelectedItem).Checked = false;
((CustomListDataItem)ddl.DropDownListElement.ListElement.SelectedItem).Selected = false;
LightVisualElement lve = ddl.DropDownListElement.EditableElement.Children[1] as LightVisualElement;
lve.Text = string.Empty;
ddl.Items[1].Selected = true;
}
}
}

Просмотреть файл

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Просмотреть файл

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4B915E93-481C-4C88-9904-460EFAF75122}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>_547099</RootNamespace>
<AssemblyName>547099</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Telerik.WinControls">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\Telerik.WinControls.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.GridView">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\Telerik.WinControls.GridView.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.UI">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\Telerik.WinControls.UI.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.UI.Design">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\Telerik.WinControls.UI.Design.dll</HintPath>
</Reference>
<Reference Include="TelerikCommon">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\TelerikCommon.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CustomDropDownList.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomEditorElement.cs" />
<Compile Include="CustomListDataItem.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="CustomListVisualItem.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiSelectDropDown", "MultiSelectDropDown.csproj", "{4B915E93-481C-4C88-9904-460EFAF75122}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4B915E93-481C-4C88-9904-460EFAF75122}.Debug|x86.ActiveCfg = Debug|x86
{4B915E93-481C-4C88-9904-460EFAF75122}.Debug|x86.Build.0 = Debug|x86
{4B915E93-481C-4C88-9904-460EFAF75122}.Release|x86.ActiveCfg = Release|x86
{4B915E93-481C-4C88-9904-460EFAF75122}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace MultiSelectDropDown
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("547099")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("547099")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c830f014-3677-44dd-93fb-8ba9c0f00774")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace _547099.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_547099.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace _547099.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

Просмотреть файл

@ -0,0 +1,42 @@
Imports Telerik.WinControls.UI
Imports System.ComponentModel
Imports System.Drawing.Design
Imports Telerik.WinControls
Public Class CustomDropDownList
Inherits RadDropDownList
Public Overrides Property ThemeClassName() As String
Get
Return GetType(RadDropDownList).FullName
End Get
Set(value As String)
End Set
End Property
Protected Overrides Function CreateDropDownListElement() As RadDropDownListElement
Return New CustomEditorElement()
End Function
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Editor(GetType(CustomListControlCollectionEditor), GetType(UITypeEditor)), Category(RadDesignCategory.DataCategory)> _
<Description("Gets a collection representing the items contained in this RadDropDownList.")> _
Public Shadows ReadOnly Property Items() As RadListDataItemCollection
Get
Return MyBase.Items
End Get
End Property
End Class
Public Class CustomListControlCollectionEditor
Inherits Telerik.WinControls.UI.Design.RadListControlCollectionEditor
Public Sub New(itemType As Type)
MyBase.New(itemType)
End Sub
Protected Overrides Function CreateNewItemTypes() As Type()
Dim baseTypes As Type() = MyBase.CreateNewItemTypes()
Dim newTypes As Type() = New Type(baseTypes.Length) {}
baseTypes.CopyTo(newTypes, 0)
newTypes(baseTypes.Length) = GetType(CustomListDataItem)
Return newTypes
End Function
End Class

Просмотреть файл

@ -0,0 +1,115 @@
Imports Telerik.WinControls.UI
Imports Telerik.WinControls.Layouts
Imports Telerik.WinControls
Imports System.Text
Public Class CustomEditorElement
Inherits RadDropDownListEditorElement
Private customText As LightVisualElement
Private closeButton As RadButtonElement
Private textChanged As Boolean
Public Sub New()
closeButton = New RadButtonElement("Close")
closeButton.SetValue(DockLayoutPanel.DockProperty, Dock.Bottom)
AddHandler closeButton.Click, AddressOf closeButton_Click
Me.Popup.SizingGripDockLayout.Children.Insert(1, closeButton)
Me.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple
AddHandler Me.PopupClosing, AddressOf CustomEditorElement_PopupClosing
AddHandler Me.CreatingVisualItem, AddressOf CustomEditorElement_CreatingVisualItem
AddHandler Me.ListElement.ItemDataBinding, AddressOf Me.CustomEditorElement_ItemDataBinding
End Sub
Private Sub deselectAll_Click(sender As Object, e As EventArgs)
Me.SetItemsCheckSelect(False)
End Sub
Private Sub selectAll_Click(sender As Object, e As EventArgs)
Me.SetItemsCheckSelect(True)
End Sub
Private Sub SetItemsCheckSelect(value As Boolean)
For Each item As CustomListDataItem In Me.Items
item.Selected = value
item.Checked = value
Next
Me.SynchronizeText()
End Sub
Protected Overrides Sub SyncVisualProperties(listItem As RadListDataItem)
End Sub
Private Sub closeButton_Click(sender As Object, e As EventArgs)
ClosePopup()
Dim cell As GridDataCellElement = TryCast(Me.Parent, GridDataCellElement)
If cell IsNot Nothing Then
cell.GridViewElement.EndEdit()
End If
End Sub
Private Sub CustomEditorElement_ItemDataBinding(sender As Object, args As ListItemDataBindingEventArgs)
args.NewItem = New CustomListDataItem()
End Sub
Private Sub CustomEditorElement_CreatingVisualItem(sender As Object, args As CreatingVisualListItemEventArgs)
args.VisualItem = New CustomListVisualItem()
End Sub
Private Sub CustomEditorElement_PopupClosing(sender As Object, args As RadPopupClosingEventArgs)
Dim editor As CustomEditorElement = DirectCast(sender, CustomEditorElement)
If args.CloseReason = RadPopupCloseReason.Mouse Then
If editor.PopupForm.Bounds.Contains(Control.MousePosition) Then
args.Cancel = True
End If
End If
End Sub
Protected Overrides Sub CreateChildElements()
MyBase.CreateChildElements()
customText = New LightVisualElement()
customText.DrawBorder = False
customText.DrawFill = True
customText.GradientStyle = GradientStyles.Solid
customText.BackColor = Color.White
customText.TextAlignment = ContentAlignment.MiddleLeft
Me.EditableElement.Children.Add(customText)
Me.TextBox.Visibility = ElementVisibility.Collapsed
Me.MinSize = New Size(0, 21)
End Sub
Public Overrides Sub ShowPopup()
Dim selected As Boolean() = New Boolean(Me.Items.Count - 1) {}
For i As Integer = 0 To selected.Length - 1
selected(i) = Me.Items(i).Selected
Next
MyBase.ShowPopup()
For i As Integer = 0 To selected.Length - 1
Me.Items(i).Selected = selected(i)
Next
End Sub
Protected Overrides Sub OnTextChanged(e As EventArgs)
SynchronizeText()
End Sub
Friend Sub SynchronizeText()
If textChanged Then
Return
End If
textChanged = True
Dim text As New StringBuilder()
For Each item As CustomListDataItem In Me.ListElement.Items
If item.Checked Then
text.AppendFormat("{0}; ", item.Text)
End If
Next
customText.Text = text.ToString()
textChanged = False
End Sub
End Class

Просмотреть файл

@ -0,0 +1,50 @@
Imports Telerik.WinControls.UI
Imports Telerik.WinControls
Imports System.ComponentModel
Public Class CustomListDataItem
Inherits RadListDataItem
#Region "RadProperties"
Public Shared ReadOnly CheckedProperty As RadProperty = RadProperty.Register("Checked", GetType(Boolean), GetType(CustomListDataItem), New RadElementPropertyMetadata(False))
#End Region
#Region "Properties"
Public Property Checked() As Boolean
Get
Return CBool(Me.GetValue(CustomListDataItem.CheckedProperty))
End Get
Set(value As Boolean)
Me.SetValue(CustomListDataItem.CheckedProperty, value)
End Set
End Property
Protected Overrides Sub OnPropertyChanged(e As RadPropertyChangedEventArgs)
MyBase.OnPropertyChanged(e)
End Sub
#End Region
#Region "Overrides"
Protected Overrides Sub SetDataBoundItem(dataBinding As Boolean, value As Object)
MyBase.SetDataBoundItem(dataBinding, value)
If TypeOf value Is INotifyPropertyChanged Then
Dim item As INotifyPropertyChanged = TryCast(value, INotifyPropertyChanged)
AddHandler item.PropertyChanged, AddressOf item_PropertyChanged
End If
End Sub
#End Region
#Region "Private Methods"
Private Sub item_PropertyChanged(sender As Object, e As PropertyChangedEventArgs)
If e.PropertyName = "Checked" Then
Me.Checked = TryCast(Me.DataBoundItem, RadListDataItem).Selected
End If
End Sub
#End Region
End Class

Просмотреть файл

@ -0,0 +1,46 @@
Imports Telerik.WinControls.UI
Public Class CustomListVisualItem
Inherits RadListVisualItem
Private checkbox As RadCheckBoxElement
Private content As LightVisualElement
Protected Overrides Sub CreateChildElements()
MyBase.CreateChildElements()
Dim stack As New StackLayoutElement()
stack.Orientation = Orientation.Horizontal
Me.Children.Add(stack)
checkbox = New RadCheckBoxElement()
AddHandler checkbox.ToggleStateChanged, AddressOf checkbox_ToggleStateChanged
stack.Children.Add(checkbox)
content = New LightVisualElement()
content.StretchHorizontally = False
content.StretchVertically = True
content.TextAlignment = ContentAlignment.MiddleLeft
content.NotifyParentOnMouseInput = True
stack.Children.Add(content)
End Sub
Private Sub checkbox_ToggleStateChanged(sender As Object, e As StateChangedEventArgs)
DirectCast(Me.Data, CustomListDataItem).Checked = Me.checkbox.Checked
Dim form As DropDownPopupForm = TryCast(Me.ElementTree.Control, DropDownPopupForm)
DirectCast(form.OwnerDropDownListElement, CustomEditorElement).SynchronizeText()
End Sub
Protected Overrides ReadOnly Property ThemeEffectiveType() As Type
Get
Return GetType(RadListVisualItem)
End Get
End Property
Protected Overrides Sub SynchronizeProperties()
MyBase.SynchronizeProperties()
checkbox.IsChecked = Me.Data.Selected
Me.content.Text = Me.Data.Text
Me.Text = ""
End Sub
End Class

86
DropDownList/MultiSelectDropDown/MultiSelectDropDownVB/Form1.Designer.vb сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,86 @@
Partial Class Form1
''' <summary>
''' Required designer variable.
''' </summary>
Private components As System.ComponentModel.IContainer = Nothing
''' <summary>
''' Clean up any resources being used.
''' </summary>
''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
Protected Overrides Sub Dispose(disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
#Region "Windows Form Designer generated code"
''' <summary>
''' Required method for Designer support - do not modify
''' the contents of this method with the code editor.
''' </summary>
Private Sub InitializeComponent()
Dim customListDataItem1 As New CustomListDataItem()
Dim customListDataItem2 As New CustomListDataItem()
Dim customListDataItem3 As New CustomListDataItem()
Dim customListDataItem4 As New CustomListDataItem()
Me.customDropDownList1 = New CustomDropDownList()
Me.radLabel1 = New Telerik.WinControls.UI.RadLabel()
DirectCast(Me.customDropDownList1, System.ComponentModel.ISupportInitialize).BeginInit()
DirectCast(Me.radLabel1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
' customDropDownList1
'
customListDataItem1.Text = "ListItem 1"
customListDataItem1.TextWrap = True
customListDataItem2.Text = "ListItem 2"
customListDataItem2.TextWrap = True
customListDataItem3.Text = "ListItem 3"
customListDataItem3.TextWrap = True
customListDataItem4.Text = "ListItem 4"
customListDataItem4.TextWrap = True
Me.customDropDownList1.Items.Add(customListDataItem1)
Me.customDropDownList1.Items.Add(customListDataItem2)
Me.customDropDownList1.Items.Add(customListDataItem3)
Me.customDropDownList1.Items.Add(customListDataItem4)
Me.customDropDownList1.Location = New System.Drawing.Point(128, 184)
Me.customDropDownList1.Name = "customDropDownList1"
Me.customDropDownList1.Size = New System.Drawing.Size(233, 21)
Me.customDropDownList1.TabIndex = 0
'
' radLabel1
'
Me.radLabel1.Location = New System.Drawing.Point(13, 184)
Me.radLabel1.Name = "radLabel1"
Me.radLabel1.Size = New System.Drawing.Size(101, 18)
Me.radLabel1.TabIndex = 1
Me.radLabel1.Text = "Added design time"
'
' Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0F, 13.0F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(400, 400)
Me.Controls.Add(Me.radLabel1)
Me.Controls.Add(Me.customDropDownList1)
Me.Name = "Form1"
Me.Text = "Form1"
AddHandler Load, AddressOf Form1_Load
DirectCast(Me.customDropDownList1, System.ComponentModel.ISupportInitialize).EndInit()
DirectCast(Me.radLabel1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Private customDropDownList1 As CustomDropDownList
Private radLabel1 As Telerik.WinControls.UI.RadLabel
End Class

Просмотреть файл

@ -0,0 +1,51 @@
Imports Telerik.WinControls.UI
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
Dim t As New DataTable()
t.Columns.Add("ID", GetType(Integer))
t.Columns.Add("Name", GetType(String))
t.Rows.Add(1, "one")
t.Rows.Add(2, "two")
t.Rows.Add(3, "three")
t.Rows.Add(4, "four")
t.Rows.Add(5, "five")
t.Rows.Add(6, "six")
t.Rows.Add(7, "seven")
t.Rows.Add(8, "eight")
t.Rows.Add(9, "nine")
t.Rows.Add(10, "ten")
Dim list As New CustomDropDownList()
list.Name = "MyDropDown"
list.Location = New Point(130, 80)
list.Size = New System.Drawing.Size(230, 20)
Controls.Add(list)
list.DisplayMember = "Name"
list.ValueMember = "ID"
list.DataSource = t
AddHandler list.SelectedIndexChanged, AddressOf list_SelectedIndexChanged
End Sub
Private Sub list_SelectedIndexChanged(sender As Object, e As Telerik.WinControls.UI.Data.PositionChangedEventArgs)
If e.Position > -1 Then
Dim list As CustomDropDownList = TryCast(sender, CustomDropDownList)
DirectCast(list.Items(e.Position), CustomListDataItem).Checked = True
DirectCast(list.DropDownListElement, CustomEditorElement).SynchronizeText()
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs)
Dim ddl As CustomDropDownList = TryCast(Me.Controls("MyDropDown"), CustomDropDownList)
DirectCast(ddl.DropDownListElement.ListElement.SelectedItem, CustomListDataItem).Checked = False
DirectCast(ddl.DropDownListElement.ListElement.SelectedItem, CustomListDataItem).Selected = False
Dim lve As LightVisualElement = TryCast(ddl.DropDownListElement.EditableElement.Children(1), LightVisualElement)
lve.Text = String.Empty
ddl.Items(1).Selected = True
End Sub
End Class

Просмотреть файл

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A07F83A4-D263-4C9D-ABEE-930C24195BF4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>MultiSelectDropDownVB.My.MyApplication</StartupObject>
<RootNamespace>MultiSelectDropDownVB</RootNamespace>
<AssemblyName>MultiSelectDropDownVB</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>MultiSelectDropDownVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>MultiSelectDropDownVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Telerik.WinControls">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\Telerik.WinControls.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.GridView">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\Telerik.WinControls.GridView.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.UI">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\Telerik.WinControls.UI.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.UI.Design">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\Telerik.WinControls.UI.Design.dll</HintPath>
</Reference>
<Reference Include="TelerikCommon">
<HintPath>B:\Backup - 03-17-2014\VERSIONS\2013.3 1328\Bin\TelerikCommon.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="CustomDropDownList.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomEditorElement.vb" />
<Compile Include="CustomListDataItem.vb" />
<Compile Include="CustomListVisualItem.vb" />
<Compile Include="Form1.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.vb">
<DependentUpon>Form1.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,38 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34011
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.MultiSelectDropDownVB.Form1
End Sub
End Class
End Namespace

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

Просмотреть файл

@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("MultiSelectDropDownVB")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("MultiSelectDropDownVB")>
<Assembly: AssemblyCopyright("Copyright © 2014")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("ec5361bc-2b3d-4209-a030-196334f88515")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

Просмотреть файл

@ -0,0 +1,62 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34011
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("MultiSelectDropDownVB.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Просмотреть файл

@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34011
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.MultiSelectDropDownVB.My.MySettings
Get
Return Global.MultiSelectDropDownVB.My.MySettings.Default
End Get
End Property
End Module
End Namespace

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>