Click here to Skip to main content
15,884,099 members
Articles / Desktop Programming / WPF

CurionLib Dynamic Data Entry Forms

Rate me:
Please Sign up or sign in to vote.
5.00/5 (20 votes)
11 Aug 2013CPOL16 min read 54.6K   5.5K   44  
Dynamic data forms.
Namespace Controls.Form
	Public Class ManageDataListItems
		Implements IManageItems
		Sub New(items As Object)
			If Not TypeOf items Is Data.List.DataList Then Throw New InvalidCastException("Must be a DataList")
			Me.Items = items
		End Sub
		Public Property NewItem As CreateNewItem Implements IManageItems.NewItem ' Ignored
		Public Property Items As Object Implements IManageItems.Items
		Public Property CanAdd As Boolean = True Implements IManageItems.CanAdd
		Public Property CanDelete As Boolean = True Implements IManageItems.CanDelete
		Public Property List As Data.List.DataList
		Public Function Add() As Object Implements IManageItems.Add
			If Not CanAdd Then Return Nothing
			With DirectCast(Items, Data.List.DataList)
				Return .Rows.NewRow()
			End With
		End Function
		Public Sub Delete(index As Integer) Implements IManageItems.Delete
			If Not CanDelete Then Return
			With DirectCast(Items, Data.List.DataList)
				.Rows.RemoveAt(index)
			End With
		End Sub
		Public Function View() As ComponentModel.ICollectionView Implements IManageItems.View
			Return CollectionViewSource.GetDefaultView(DirectCast(Items, Data.List.DataList).Rows)
		End Function
	End Class
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
I enjoy my wife, living in the woods, my 7 dogs, and learning new things. I like to play with UI stuff and model based coding.

Comments and Discussions