LookupGrid: version 0.2.0.0
This commit is contained in:
parent
c9e0d8cec1
commit
ba1806466d
@ -16,10 +16,20 @@ Public Class LookupControl2
|
||||
Public Delegate Sub SelectedValuesChangedHandler(sender As Object, SelectedValues As List(Of String))
|
||||
Public Event SelectedValuesChanged As SelectedValuesChangedHandler
|
||||
|
||||
Public Property MultiSelect As Boolean
|
||||
Public Property AllowAddNewValues As Boolean
|
||||
Public Property PreventDuplicates As Boolean
|
||||
Public Property DataSource As DataTable
|
||||
|
||||
Public Property MultiSelect As Boolean
|
||||
Get
|
||||
Return _Multiselect
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
SetDropdownButtonEnabled(value)
|
||||
_MultiSelect = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property SelectedValues As List(Of String)
|
||||
Get
|
||||
Return _SelectedValues
|
||||
@ -28,6 +38,7 @@ Public Class LookupControl2
|
||||
UpdateSelectedValues(value)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Overloads Property [ReadOnly] As Boolean
|
||||
Get
|
||||
Return _ReadOnly
|
||||
@ -47,8 +58,10 @@ Public Class LookupControl2
|
||||
Private Const TEXT_N_RECORDS = "{0} Datensätze ausgewählt"
|
||||
|
||||
Private _SelectedValues As New List(Of String)
|
||||
Friend WithEvents fProperties As RepositoryItemGridLookUpEdit
|
||||
Friend WithEvents fPropertiesView As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _MultiSelect As Boolean
|
||||
|
||||
Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Friend WithEvents GridView2 As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _ReadOnly As Boolean = False
|
||||
|
||||
Shared Sub New()
|
||||
@ -183,31 +196,6 @@ Public Class LookupControl2
|
||||
Return RepositoryItemLookupControl2.CustomEditName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
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
|
||||
|
||||
<UserRepositoryItem("RegisterLookupControl2")>
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("0.0.1.0")>
|
||||
<Assembly: AssemblyVersion("0.0.2.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@ -10,6 +10,7 @@ Public Class frmLookupGrid
|
||||
Public Property SelectedValues As List(Of String)
|
||||
|
||||
Private dataColumn As Integer
|
||||
Private dataSourceTemp As DataTable
|
||||
Private view As GridView
|
||||
Private grid As GridControl
|
||||
|
||||
@ -17,25 +18,27 @@ Public Class frmLookupGrid
|
||||
view = viewLookup
|
||||
grid = gridLookup
|
||||
|
||||
|
||||
If DataSource Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Original Datasource soll nicht verändert werden
|
||||
dataSourceTemp = DataSource.Copy()
|
||||
|
||||
If MultiSelect Then
|
||||
If Not DataSource.Columns.Contains("SELECTED") Then
|
||||
If Not dataSourceTemp.Columns.Contains("SELECTED") Then
|
||||
Dim selectedColumn = New DataColumn() With {
|
||||
.ColumnName = "SELECTED",
|
||||
.DataType = GetType(Boolean),
|
||||
.DefaultValue = False
|
||||
}
|
||||
DataSource.Columns.Add(selectedColumn)
|
||||
dataSourceTemp.Columns.Add(selectedColumn)
|
||||
selectedColumn.SetOrdinal(0)
|
||||
End If
|
||||
End If
|
||||
|
||||
' Datasource setzen
|
||||
grid.DataSource = DataSource
|
||||
grid.DataSource = dataSourceTemp
|
||||
|
||||
' Anzeige Eigeschaften setzen
|
||||
view.OptionsFind.AlwaysVisible = True
|
||||
@ -71,7 +74,9 @@ Public Class frmLookupGrid
|
||||
|
||||
' Focus auf Find panel setzen
|
||||
view.ShowFindPanel()
|
||||
Me.BringToFront()
|
||||
|
||||
' Spaltenbreite anpassen
|
||||
view.BestFitColumns()
|
||||
End Sub
|
||||
|
||||
Private Sub SyncItemsWithView(view As GridView)
|
||||
@ -195,6 +200,6 @@ Public Class frmLookupGrid
|
||||
End Sub
|
||||
|
||||
Private Sub frmLookupGrid_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
Me.BringToFront()
|
||||
BringToFront()
|
||||
End Sub
|
||||
End Class
|
||||
6
LookupControlGui/Form1.Designer.vb
generated
6
LookupControlGui/Form1.Designer.vb
generated
@ -89,6 +89,8 @@ Partial Class Form1
|
||||
Me.LookupControl.Name = "LookupControl"
|
||||
Me.LookupControl.PreventDuplicates = False
|
||||
Me.LookupControl.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", "openDropdown", Nothing, DevExpress.Utils.ToolTipAnchor.[Default]), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions2, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject5, SerializableAppearanceObject6, SerializableAppearanceObject7, SerializableAppearanceObject8, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
|
||||
Me.LookupControl.Properties.DataSource = CType(resources.GetObject("LookupControl.Properties.DataSource"), Object)
|
||||
Me.LookupControl.Properties.NullText = "Keine Datensätze ausgewählt"
|
||||
Me.LookupControl.Properties.PopupView = Me.LookupControl21View
|
||||
Me.LookupControl.SelectedValues = CType(resources.GetObject("LookupControl.SelectedValues"), System.Collections.Generic.List(Of String))
|
||||
Me.LookupControl.Size = New System.Drawing.Size(342, 20)
|
||||
@ -119,6 +121,8 @@ Partial Class Form1
|
||||
Me.LookupControl21.Name = "LookupControl21"
|
||||
Me.LookupControl21.PreventDuplicates = False
|
||||
Me.LookupControl21.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, True, True, False, EditorButtonImageOptions3, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject9, SerializableAppearanceObject10, SerializableAppearanceObject11, SerializableAppearanceObject12, "", "openDropdown", Nothing, DevExpress.Utils.ToolTipAnchor.[Default]), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions4, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject13, SerializableAppearanceObject14, SerializableAppearanceObject15, SerializableAppearanceObject16, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
|
||||
Me.LookupControl21.Properties.DataSource = CType(resources.GetObject("LookupControl21.Properties.DataSource"), Object)
|
||||
Me.LookupControl21.Properties.NullText = "Keine Datensätze ausgewählt"
|
||||
Me.LookupControl21.Properties.PopupView = Me.GridView1
|
||||
Me.LookupControl21.SelectedValues = CType(resources.GetObject("LookupControl21.SelectedValues"), System.Collections.Generic.List(Of String))
|
||||
Me.LookupControl21.Size = New System.Drawing.Size(342, 20)
|
||||
@ -150,7 +154,7 @@ Partial Class Form1
|
||||
Me.LookupControl22.PreventDuplicates = False
|
||||
Me.LookupControl22.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, True, True, False, EditorButtonImageOptions5, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject17, SerializableAppearanceObject18, SerializableAppearanceObject19, SerializableAppearanceObject20, "", "openDropdown", Nothing, DevExpress.Utils.ToolTipAnchor.[Default]), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions6, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject21, SerializableAppearanceObject22, SerializableAppearanceObject23, SerializableAppearanceObject24, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
|
||||
Me.LookupControl22.Properties.DataSource = CType(resources.GetObject("LookupControl22.Properties.DataSource"), Object)
|
||||
Me.LookupControl22.Properties.NullText = "Keine Datensätze ausgewählt"
|
||||
Me.LookupControl22.Properties.NullText = ""
|
||||
Me.LookupControl22.Properties.PopupView = Me.GridView2
|
||||
Me.LookupControl22.SelectedValues = CType(resources.GetObject("LookupControl22.SelectedValues"), System.Collections.Generic.List(Of String))
|
||||
Me.LookupControl22.Size = New System.Drawing.Size(342, 20)
|
||||
|
||||
@ -117,6 +117,15 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="LookupControl.Properties.DataSource" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
|
||||
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u
|
||||
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
|
||||
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
|
||||
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs=
|
||||
</value>
|
||||
</data>
|
||||
<data name="LookupControl.SelectedValues" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
|
||||
@ -124,6 +133,15 @@
|
||||
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
|
||||
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
|
||||
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs=
|
||||
</value>
|
||||
</data>
|
||||
<data name="LookupControl21.Properties.DataSource" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
|
||||
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u
|
||||
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
|
||||
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
|
||||
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs=
|
||||
</value>
|
||||
</data>
|
||||
<data name="LookupControl21.SelectedValues" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
LookupControl22.ReadOnly = False
|
||||
LookupControl22.MultiSelect = False
|
||||
|
||||
LookupControl22.SelectedValues = New List(Of String) From {"", Nothing, "LOL"}
|
||||
LookupControl22.SelectedValues = New List(Of String) From {"", Nothing, "LOL", "Foo"}
|
||||
|
||||
AddHandler LookupControl.SelectedValuesChanged, Sub(_sender As Object, SelectedValues As List(Of String))
|
||||
MsgBox("Selected Values: " & String.Join(",", SelectedValues.ToArray))
|
||||
@ -36,7 +36,8 @@
|
||||
Private Function GetDatatable() As DataTable
|
||||
Dim oDatatable As New DataTable
|
||||
Dim oColumns As New List(Of DataColumn) From {
|
||||
New DataColumn("Col1", GetType(String))
|
||||
New DataColumn("Col1", GetType(String)),
|
||||
New DataColumn("Col2", GetType(String))
|
||||
}
|
||||
|
||||
oDatatable.Columns.AddRange(oColumns.ToArray)
|
||||
@ -44,6 +45,7 @@
|
||||
For Each Item In _Datasource
|
||||
Dim oRow = oDatatable.NewRow()
|
||||
oRow.Item("Col1") = Item
|
||||
oRow.Item("Col2") = Item & "_" & "SomeLong Random(String) !!!111einself"
|
||||
oDatatable.Rows.Add(oRow)
|
||||
Next
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user