A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

75 lines
2.5 KiB

// -----------------------------------------------------------------------
// <copyright file="ScrollBar.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex.Controls.Primitives
{
using System;
public class ScrollBar : TemplatedControl
{
public static readonly PerspexProperty<double> MinimumProperty =
PerspexProperty.Register<ScrollBar, double>("Minimum");
public static readonly PerspexProperty<double> MaximumProperty =
PerspexProperty.Register<ScrollBar, double>("Maximum", defaultValue: 100.0);
public static readonly PerspexProperty<double> ValueProperty =
PerspexProperty.Register<ScrollBar, double>("Value");
public static readonly PerspexProperty<double> ViewportSizeProperty =
PerspexProperty.Register<ScrollBar, double>("ViewportSize", defaultValue: double.NaN);
public static readonly PerspexProperty<Orientation> OrientationProperty =
PerspexProperty.Register<ScrollBar, Orientation>("Orientation");
public ScrollBar()
{
this.GetObservable(OrientationProperty).Subscribe(o =>
{
if (o == Orientation.Horizontal)
{
this.Classes.Remove(":vertical");
this.Classes.Add(":horizontal");
}
else
{
this.Classes.Remove(":horizontal");
this.Classes.Add(":vertical");
}
});
}
public double Minimum
{
get { return this.GetValue(MinimumProperty); }
set { this.SetValue(MinimumProperty, value); }
}
public double Maximum
{
get { return this.GetValue(MaximumProperty); }
set { this.SetValue(MaximumProperty, value); }
}
public double Value
{
get { return this.GetValue(ValueProperty); }
set { this.SetValue(ValueProperty, value); }
}
public double ViewportSize
{
get { return this.GetValue(ViewportSizeProperty); }
set { this.SetValue(ViewportSizeProperty, value); }
}
public Orientation Orientation
{
get { return this.GetValue(OrientationProperty); }
set { this.SetValue(OrientationProperty, value); }
}
}
}