From 785f89f14b409ee193db8edb78ed6adc7a123e02 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 29 Nov 2014 14:37:11 +0100 Subject: [PATCH] Display scrollbar value in test app. Value is currently wrong, surprise! --- Perspex.Themes.Default/ScrollBarStyle.cs | 2 +- TestApplication/Program.cs | 34 +++++++++++++++++++----- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Perspex.Themes.Default/ScrollBarStyle.cs b/Perspex.Themes.Default/ScrollBarStyle.cs index 5783db4b21..ad904b08a1 100644 --- a/Perspex.Themes.Default/ScrollBarStyle.cs +++ b/Perspex.Themes.Default/ScrollBarStyle.cs @@ -54,7 +54,7 @@ namespace Perspex.Themes.Default { [~Track.MinimumProperty] = control[~ScrollBar.MinimumProperty], [~Track.MaximumProperty] = control[~ScrollBar.MaximumProperty], - [~Track.ValueProperty] = control[~ScrollBar.ValueProperty], + [~~Track.ValueProperty] = control[~ScrollBar.ValueProperty], [~Track.ViewportSizeProperty] = control[~ScrollBar.ViewportSizeProperty], [~Track.OrientationProperty] = control[~ScrollBar.OrientationProperty], Thumb = new Thumb diff --git a/TestApplication/Program.cs b/TestApplication/Program.cs index 2cfa64ad23..5f988249c7 100644 --- a/TestApplication/Program.cs +++ b/TestApplication/Program.cs @@ -1,4 +1,5 @@ -using Perspex; +using System.Reactive.Linq; +using Perspex; using Perspex.Controls; using Perspex.Controls.Primitives; using Perspex.Diagnostics; @@ -248,15 +249,25 @@ namespace TestApplication private static TabItem SlidersTab() { + ScrollBar sb; + return new TabItem { Header = "Sliders", - Content = new StackPanel + Content = new Grid { - Orientation = Orientation.Horizontal, + ColumnDefinitions = new ColumnDefinitions + { + new ColumnDefinition(GridLength.Auto), + new ColumnDefinition(GridLength.Auto), + }, + RowDefinitions = new RowDefinitions + { + new RowDefinition(GridLength.Auto), + new RowDefinition(GridLength.Auto), + }, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, - Gap = 8, Children = new Controls { new ScrollBar @@ -265,14 +276,25 @@ namespace TestApplication ViewportSize = 25, Value = 25, Height = 300, + [Grid.ColumnProperty] = 0, + [Grid.RowProperty] = 1, }, - new ScrollBar + (sb = new ScrollBar { Orientation = Orientation.Horizontal, ViewportSize = 25, Value = 25, Width = 300, - }, + [Grid.ColumnProperty] = 1, + [Grid.RowProperty] = 0, + }), + new TextBlock + { + HorizontalAlignment = HorizontalAlignment.Center, + [!TextBlock.TextProperty] = sb[!ScrollBar.ValueProperty].Cast().Select(x => x.ToString("0")), + [Grid.ColumnProperty] = 1, + [Grid.RowProperty] = 1, + } }, } };