|
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.
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.