Click here to Skip to main content
15,885,366 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.7K   5.5K   44  
Dynamic data forms.
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data

Namespace Controls.Form
	Public Class IntegerSliderColumn
		Inherits BaseColumn
		Public Property MinValue As Integer
		Public Property MaxValue As Integer
		Public Property LargeChange As Integer
		Sub New()
			StyleName = Defaults("Form.Column.Slider.StyleName")
			Height = Defaults("Form.Column.Slider.Height")
			Width = Defaults("Form.Column.Slider.Width")
			SuppressHeading = Defaults("Form.Column.Slider.SuppressHeading")
			Stretch = Defaults("Form.Column.Slider.Stretch")
			IsRequired = Defaults("Form.Column.Slider.IsRequired")
			IsReadonly = Defaults("Form.Column.Slider.IsReadonly")
			MinValue = Defaults("Form.Column.Slider.MinValue")
			MaxValue = Defaults("Form.Column.Slider.MaxValue")
			LargeChange = Defaults("Form.Column.Slider.LargeChange")
		End Sub
		Public Overrides Function CreateControl(form As DataForm) As FrameworkElement
			Dim ctl As New Slider
			Dim bind As Binding = Nothing
			If StyleName <> String.Empty Then
				Dim style = form.TryFindResource(StyleName)
				ctl.Style = style
			End If
			If Path <> String.Empty Then bind.Path = New PropertyPath(Path)
			ctl.HorizontalAlignment = HorizontalAlignment.Left
			ctl.Margin = New Thickness(0, 4, 0, 0)
			If bind.ValidationRules.Count Then bind.ValidatesOnDataErrors = True
			ctl.Minimum = MinValue
			ctl.Maximum = MaxValue
			ctl.LargeChange = LargeChange
			ctl.SetBinding(Slider.ValueProperty, bind)
			ctl.Width = Double.NaN
			ctl.Height = Height
			ctl.Tag = bind
			Return ctl
		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