Skip to content

Simple ruler for wpf (.net core and .net framework)

License

Notifications You must be signed in to change notification settings

xclemence/Ruler.Wpf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruler.Wpf

License: MIT .NET Core Quality Gate Status

In the WPF world, many controls exist, but it difficult to find a ruler. This project proposes a simple ruler usable in all Net Core 3.1 and Net Framework 4.7.2.

Focused objectifs

  • Performance
  • Simplicity
  • Customization
  • Maintainability

Features

Features available in control are:

  • Definition of custom main step for scale
  • Dynamic scale on resize
  • Horizontal and vertical support (top and left position)
  • Mark linked to mouse position
  • Multi ruler synchronization
  • Multi cultures
  • Multiscale units
  • Styling sample
  • MVVM pattern

Getting started

Add the resource dictionary inside application resources:

<ResourceDictionary>
  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/Ruler.Wpf;component/RulerStyle.xaml"/>
  </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

Use control as you need

<ruler:Ruler MarkerControlReference="{Binding ElementName=mainView}"
             MaxValue="400"
             MajorStepValues="{Binding MajorStep}"
             ValueStepTransform="{Binding ValueStepTransform}">
    <ruler:Ruler.Resources>
        <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
            <Setter Property="Margin" Value="5 0"/>
        </Style>
    </ruler:Ruler.Resources>
</ruler:Ruler

Testabilty

A WPF Net Core application shows how to use the ruler.

About

Simple ruler for wpf (.net core and .net framework)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages