First Pass of new LookupControl
This commit is contained in:
parent
07c44d69c4
commit
21ee4416ef
@ -1,123 +0,0 @@
|
||||
<?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>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@ -1,131 +0,0 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
Imports DevExpress.XtraEditors.Repository
|
||||
|
||||
Public Class GridLookupEditExOLD
|
||||
Inherits GridLookUpEdit
|
||||
|
||||
<Category("Einstellungen"), Description("Gibt an, ob mehrere Werte auswählbar sind"), DefaultValue(False)>
|
||||
Public Property MultiSelect As Boolean
|
||||
<Category("Einstellungen"), Description("Gibt an, ob neue Werte hinzugefügt werden können"), DefaultValue(False)>
|
||||
Public Property AllowAddNewValues As Boolean
|
||||
<Category("Einstellungen"), Description("Gibt an, ob das Hinzufügen von identischen Werten erlaubt ist"), DefaultValue(False)>
|
||||
Public Property PreventDuplicates As Boolean
|
||||
|
||||
Public Property DataSource As DataTable
|
||||
|
||||
Public Property SelectedValues As List(Of String)
|
||||
Get
|
||||
If _selectedValues Is Nothing Then
|
||||
Return New List(Of String)
|
||||
End If
|
||||
|
||||
Return _selectedValues
|
||||
End Get
|
||||
Set(value As List(Of String))
|
||||
_selectedValues = value
|
||||
|
||||
UpdateSelectedValues(value)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private _selectedValues As List(Of String)
|
||||
|
||||
Private Const TAG_BUTTON_LOOKUP_FORM = "openLookupForm"
|
||||
Private Const TEXT_NO_RECORDS = "Keine Datensätze ausgewählt"
|
||||
Friend WithEvents fProperties As RepositoryItemGridLookUpEdit
|
||||
Friend WithEvents fPropertiesView As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private Const TEXT_N_RECORDS = "{0} Datensätze ausgewählt"
|
||||
|
||||
Public Sub New()
|
||||
Properties.View.OptionsBehavior.ReadOnly = True
|
||||
Properties.View.OptionsBehavior.Editable = False
|
||||
Properties.View.OptionsView.ShowColumnHeaders = False
|
||||
Properties.PopupFormSize = New System.Drawing.Size(Properties.PopupFormSize.Width, 100)
|
||||
|
||||
' If single select, remove dropdown button
|
||||
If MultiSelect = False Then
|
||||
Properties.Buttons.Clear()
|
||||
End If
|
||||
|
||||
Properties.Buttons.Add(New EditorButton() With {
|
||||
.Kind = ButtonPredefines.Ellipsis,
|
||||
.Tag = TAG_BUTTON_LOOKUP_FORM
|
||||
})
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function GetLookupForm() As frmLookupGrid
|
||||
Dim oForm As New frmLookupGrid() With {
|
||||
.MultiSelect = MultiSelect,
|
||||
.AddNewValues = AllowAddNewValues,
|
||||
.PreventDuplicates = PreventDuplicates,
|
||||
.DataSource = DataSource,
|
||||
.SelectedValues = SelectedValues,
|
||||
.StartPosition = Windows.Forms.FormStartPosition.Manual,
|
||||
.Location = PointToScreen(New System.Drawing.Point(Width, 0))
|
||||
}
|
||||
|
||||
Return oForm
|
||||
End Function
|
||||
|
||||
Private Sub UpdateSelectedValues(Values As List(Of String))
|
||||
If MultiSelect = True Then
|
||||
Properties.DataSource = Values
|
||||
Properties.NullText = IIf(Values.Count = 0, TEXT_NO_RECORDS, String.Format(TEXT_N_RECORDS, Values.Count))
|
||||
Else
|
||||
Text = Values.FirstOrDefault()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GridLookupEditEx_EditValueChanging(sender As Object, e As ChangingEventArgs) Handles Me.EditValueChanging
|
||||
If MultiSelect Then
|
||||
e.Cancel = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub lookupControlMulti_ButtonClick(sender As Object, e As ButtonPressedEventArgs)
|
||||
If e.Button.Tag <> TAG_BUTTON_LOOKUP_FORM Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oForm As frmLookupGrid = GetLookupForm()
|
||||
Dim oResult = oForm.ShowDialog()
|
||||
|
||||
If oResult = Windows.Forms.DialogResult.OK Then
|
||||
Dim oValues = oForm.SelectedValues
|
||||
|
||||
UpdateSelectedValues(oValues)
|
||||
|
||||
SelectedValues = oValues
|
||||
End If
|
||||
|
||||
oForm.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeComponent()
|
||||
Me.fProperties = New DevExpress.XtraEditors.Repository.RepositoryItemGridLookUpEdit()
|
||||
Me.fPropertiesView = New DevExpress.XtraGrid.Views.Grid.GridView()
|
||||
CType(Me.fProperties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.fPropertiesView, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'fProperties
|
||||
'
|
||||
Me.fProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
|
||||
Me.fProperties.Name = "fProperties"
|
||||
Me.fProperties.PopupView = Me.fPropertiesView
|
||||
'
|
||||
'fPropertiesView
|
||||
'
|
||||
Me.fPropertiesView.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus
|
||||
Me.fPropertiesView.Name = "fPropertiesView"
|
||||
Me.fPropertiesView.OptionsSelection.EnableAppearanceFocusedCell = False
|
||||
Me.fPropertiesView.OptionsView.ShowGroupPanel = False
|
||||
CType(Me.fProperties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.fPropertiesView, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
@ -105,9 +105,6 @@
|
||||
<Compile Include="frmLookupGrid.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GridLookupEditExOLD.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LookupControl.Designer.vb">
|
||||
<DependentUpon>LookupControl.vb</DependentUpon>
|
||||
</Compile>
|
||||
@ -117,7 +114,6 @@
|
||||
<Compile Include="LookupControl2.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LookupCreator.vb" />
|
||||
<Compile Include="LookupGridHandler.vb" />
|
||||
<Compile Include="LookupGridRegistration.vb" />
|
||||
<Compile Include="LookupGridView.Designer.vb">
|
||||
@ -152,9 +148,6 @@
|
||||
<EmbeddedResource Include="frmLookupGrid.resx">
|
||||
<DependentUpon>frmLookupGrid.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GridLookupEditExOLD.resx">
|
||||
<DependentUpon>GridLookupEditExOLD.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="LookupControl.resx">
|
||||
<DependentUpon>LookupControl.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@ -7,6 +7,9 @@ Imports DevExpress.XtraEditors.Repository
|
||||
Imports DevExpress.XtraEditors.ViewInfo
|
||||
Imports DevExpress.XtraEditors.Popup
|
||||
Imports DevExpress.Accessibility
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
|
||||
|
||||
|
||||
<UserRepositoryItem("RegisterLookupControl2")>
|
||||
Public Class RepositoryItemLookupControl2
|
||||
@ -51,14 +54,76 @@ End Class
|
||||
Public Class LookupControl2
|
||||
Inherits GridLookUpEdit
|
||||
|
||||
Public Property MultiSelect As Boolean
|
||||
Public Property AllowAddNewValues As Boolean
|
||||
Public Property PreventDuplicates As Boolean
|
||||
Public Property DataSource As DataTable
|
||||
Public Property SelectedValues As List(Of String)
|
||||
|
||||
Private Const TAG_BUTTON_LOOKUP_FORM = "openLookupForm"
|
||||
Private Const TEXT_NO_RECORDS = "Keine Datensätze ausgewählt"
|
||||
Private Const TEXT_N_RECORDS = "{0} Datensätze ausgewählt"
|
||||
|
||||
Shared Sub New()
|
||||
RepositoryItemLookupControl2.RegisterLookupControl2()
|
||||
End Sub
|
||||
|
||||
Public Sub New()
|
||||
Properties.Buttons.Add(New EditorButton() With {
|
||||
.Kind = ButtonPredefines.Ellipsis,
|
||||
.Tag = TAG_BUTTON_LOOKUP_FORM
|
||||
})
|
||||
|
||||
AddHandler ButtonClick, AddressOf HandleButtonClick
|
||||
AddHandler EditValueChanging, AddressOf HandleEditValueChanging
|
||||
End Sub
|
||||
|
||||
Private Sub HandleEditValueChanging(sender As Object, e As ChangingEventArgs)
|
||||
e.Cancel = True
|
||||
End Sub
|
||||
|
||||
Private Sub HandleButtonClick(sender As Object, e As ButtonPressedEventArgs)
|
||||
If e.Button.Tag <> TAG_BUTTON_LOOKUP_FORM Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oForm As frmLookupGrid = GetLookupForm()
|
||||
Dim oResult = oForm.ShowDialog()
|
||||
|
||||
If oResult = Windows.Forms.DialogResult.OK Then
|
||||
Dim oValues = oForm.SelectedValues
|
||||
|
||||
UpdateSelectedValues(oValues)
|
||||
|
||||
SelectedValues = oValues
|
||||
End If
|
||||
|
||||
oForm.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateSelectedValues(Values As List(Of String))
|
||||
If MultiSelect = True Then
|
||||
Properties.DataSource = Values
|
||||
Properties.NullText = IIf(Values.Count = 0, TEXT_NO_RECORDS, String.Format(TEXT_N_RECORDS, Values.Count))
|
||||
Else
|
||||
Text = Values.FirstOrDefault()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function GetLookupForm() As frmLookupGrid
|
||||
Dim oForm As New frmLookupGrid() With {
|
||||
.MultiSelect = MultiSelect,
|
||||
.AddNewValues = AllowAddNewValues,
|
||||
.PreventDuplicates = PreventDuplicates,
|
||||
.DataSource = DataSource,
|
||||
.SelectedValues = SelectedValues,
|
||||
.StartPosition = Windows.Forms.FormStartPosition.Manual,
|
||||
.Location = PointToScreen(New Point(Width, 0))
|
||||
}
|
||||
|
||||
Return oForm
|
||||
End Function
|
||||
|
||||
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
|
||||
Public Shadows ReadOnly Property Properties As RepositoryItemLookupControl2
|
||||
Get
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Public Class LookupCreator
|
||||
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user