From 17adc165fac856beeadcce6d231e301d541124aa Mon Sep 17 00:00:00 2001 From: Yoojun Zhou Date: Thu, 31 Oct 2024 13:26:51 +0800 Subject: [PATCH] Example code for Canvas --- .../ControlPages/CalendarViewPage.xaml | 8 --- .../ControlPages/CanvasPage.xaml | 19 ++----- .../ControlPages/CanvasPage.xaml.cs | 56 ++++++++++++++++++- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CalendarViewPage.xaml b/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CalendarViewPage.xaml index 51653e25..5aa67adc 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CalendarViewPage.xaml +++ b/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CalendarViewPage.xaml @@ -46,14 +46,6 @@ SelectionChanged="CalendarLanguages_SelectionChanged" /> - - - -<Calendar - SelectionMode="$(SelectionMode)" - Language="$(Language)" /> - - diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CanvasPage.xaml b/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CanvasPage.xaml index d573c58e..26f17536 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CanvasPage.xaml +++ b/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CanvasPage.xaml @@ -61,7 +61,8 @@ Maximum="100" Minimum="0" Orientation="Vertical" - TickFrequency="1"> + TickFrequency="1" + ValueChanged="TopSlider_ValueChanged"> @@ -74,7 +75,8 @@ AutoToolTipPlacement="TopLeft" Maximum="100" Minimum="0" - TickFrequency="1" /> + TickFrequency="1" + ValueChanged="LeftSlider_ValueChanged"/> + TickFrequency="1" + ValueChanged="ZSlider_ValueChanged"/> - - -<Canvas Width="120" Height="120" Background="Gray"> - <Rectangle Fill="Red" Canvas.Left="$(Left)" Canvas.Top="$(Top)" Canvas.ZIndex="$(Z)" /> - <Rectangle Fill="Blue" Canvas.Left="20" Canvas.Top="20" Canvas.ZIndex="1" /> - <Rectangle Fill="Green" Canvas.Left="40" Canvas.Top="40" Canvas.ZIndex="2" /> - <Rectangle Fill="Yellow" Canvas.Left="60" Canvas.Top="60" Canvas.ZIndex="3" /> -</Canvas> - - diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CanvasPage.xaml.cs b/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CanvasPage.xaml.cs index 220a285f..7fafab6b 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CanvasPage.xaml.cs +++ b/source/iNKORE.UI.WPF.Modern.Gallery/ControlPages/CanvasPage.xaml.cs @@ -60,16 +60,68 @@ private void Page_Loaded(object sender, RoutedEventArgs e) Path = new PropertyPath("Value"), }); Example1.Substitutions = new ObservableCollection { Substitution1, Substitution2, Substitution3 }; + + UpdateExampleCode(); + } + + private void TopSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + UpdateExampleCode(); + } + + private void LeftSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + UpdateExampleCode(); + } + + private void ZSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + UpdateExampleCode(); } #region Example Code public void UpdateExampleCode() { - + Example1.Xaml = Example1Xaml; } - #endregion + public string Example1Xaml => $@" + + + + + + + + + +"; + #endregion } }