Skip to content

Commit

Permalink
Update RulerControlExample.xaml
Browse files Browse the repository at this point in the history
  • Loading branch information
yanjinhuagood committed Dec 1, 2024
1 parent abfa577 commit d22e92d
Showing 1 changed file with 73 additions and 34 deletions.
107 changes: 73 additions & 34 deletions src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,86 @@
<UserControl x:Class="WPFDevelopers.Samples.ExampleViews.RulerControlExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl
x:Class="WPFDevelopers.Samples.ExampleViews.RulerControlExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<controls:CodeViewer>
<Grid>
<Slider x:Name="PART_Slider" IsSnapToTickEnabled="True"
Value="40"
<Slider
x:Name="PART_Slider"
IsSnapToTickEnabled="True"
Maximum="210"
Minimum="10"
Maximum="210"/>
Value="40" />
<TextBlock
Margin="0,20"
HorizontalAlignment="Center"
IsHitTestVisible="False"
Text="{Binding ElementName=PART_Ruler, Path=Value}" />

<UniformGrid Rows="3">
<Grid Background="{StaticResource WD.CircularDualSolidColorBrush}" Height="51" Margin="40,0">
<Path Stroke="{StaticResource WD.SuccessPressedSolidColorBrush}" StrokeThickness="1" Fill="{StaticResource WD.SuccessPressedSolidColorBrush}"
Data="{Binding ElementName=PART_Ruler, Path=CurrentGeometry,Mode=TwoWay}" />
<wd:Ruler x:Name="PART_Ruler" Margin="40,0" Interval="20" StartValue="10" EndValue="210"
CurrentValue="{Binding ElementName=PART_Slider,Path=Value,Mode=TwoWay}"/>
<Grid
Height="51"
Margin="40,0"
Background="{StaticResource WD.CircularDualSolidColorBrush}">
<Path
Data="{Binding ElementName=PART_Ruler, Path=Geometry, Mode=TwoWay}"
Fill="{StaticResource WD.SuccessPressedSolidColorBrush}"
Stroke="{StaticResource WD.SuccessPressedSolidColorBrush}"
StrokeThickness="1" />
<wd:Ruler
x:Name="PART_Ruler"
Margin="40,0"
Interval="20"
Maximum="210"
Minimum="10"
Value="{Binding ElementName=PART_Slider, Path=Value, Mode=TwoWay}" />
</Grid>
<Grid Background="{StaticResource WD.DangerPressedSolidColorBrush}" Height="51" Margin="40,0">
<Path Stroke="{StaticResource WD.SuccessPressedSolidColorBrush}" StrokeThickness="1" Fill="{StaticResource WD.SuccessPressedSolidColorBrush}"
Data="{Binding ElementName=PART_Ruler1, Path=CurrentGeometry,Mode=TwoWay}" />
<wd:Ruler x:Name="PART_Ruler1" Margin="40,0" Interval="20" StartValue="10" EndValue="210"
CurrentValue="{Binding ElementName=PART_Slider,Path=Value,Mode=TwoWay}"/>
<Grid
Height="51"
Margin="40,0"
Background="{StaticResource WD.DangerPressedSolidColorBrush}">
<Path
Data="{Binding ElementName=PART_Ruler1, Path=Geometry, Mode=TwoWay}"
Fill="{StaticResource WD.SuccessPressedSolidColorBrush}"
Stroke="{StaticResource WD.SuccessPressedSolidColorBrush}"
StrokeThickness="1" />
<wd:Ruler
x:Name="PART_Ruler1"
Margin="40,0"
Interval="20"
Maximum="210"
Minimum="10"
Value="{Binding ElementName=PART_Slider, Path=Value, Mode=TwoWay}" />
</Grid>
<Grid Background="{StaticResource WD.WarningPressedSolidColorBrush}" Height="51" Margin="40,0">
<Path Stroke="{StaticResource WD.SuccessPressedSolidColorBrush}" StrokeThickness="1" Fill="{StaticResource WD.SuccessPressedSolidColorBrush}"
Data="{Binding ElementName=PART_Ruler2, Path=CurrentGeometry,Mode=TwoWay}" />
<wd:Ruler x:Name="PART_Ruler2" Margin="40,0" Interval="20" StartValue="10" EndValue="210"
CurrentValue="{Binding ElementName=PART_Slider,Path=Value,Mode=TwoWay}"/>
<Grid
Height="51"
Margin="40,0"
Background="{StaticResource WD.WarningPressedSolidColorBrush}">
<Path
Data="{Binding ElementName=PART_Ruler2, Path=Geometry, Mode=TwoWay}"
Fill="{StaticResource WD.SuccessPressedSolidColorBrush}"
Stroke="{StaticResource WD.SuccessPressedSolidColorBrush}"
StrokeThickness="1" />
<wd:Ruler
x:Name="PART_Ruler2"
Margin="40,0"
Interval="20"
Maximum="210"
Minimum="10"
Value="{Binding ElementName=PART_Slider, Path=Value, Mode=TwoWay}" />
</Grid>
</UniformGrid>
</Grid>
<controls:CodeViewer.SourceCodes>
<controls:SourceCodeModel
CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/RulerControlExample.xaml"
CodeType="Xaml"/>
<controls:SourceCodeModel
CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/RulerControlExample.xaml.cs"
CodeType="CSharp"/>
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/RulerControlExample.xaml" CodeType="Xaml" />
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/RulerControlExample.xaml.cs" CodeType="CSharp" />
</controls:CodeViewer.SourceCodes>
</controls:CodeViewer>
</UserControl>

0 comments on commit d22e92d

Please sign in to comment.