DRKV333 / Ruler.Wpf

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)

License:MIT License


Languages

Language:C# 100.0%