Introduction
This is a control providing a form of digital LCD segment display for use within a .NET AvaloniaUI applications.
How To Use The Control
Installation
dotnet add package JamSoft.AvaloniaUI.Lcd --version 1.1.0
Install-Package JamSoft.AvaloniaUI.Lcd -Version 1.1.0
<PackageReference Include="JamSoft.AvaloniaUI.Lcd" Version="1.1.0" />
paket add JamSoft.AvaloniaUI.Lcd --version 1.1.0
Import Styles
<Application.Styles>
<FluentTheme Mode="Dark"/>
<StyleInclude Source="avares://JamSoft.AvaloniaUI.Lcd/Themes/Default.axaml"/>
</Application.Styles>
The default style provided is very simple and be easily replaced.
<Style Selector="lcd|LcdLabel">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type lcd:LcdLabel}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Usage
<lcd:LcdLabel Text="Default" />
We’re defining a basic default LCD label, nothing fancy.
Predefined Color Themes
<lcd:LcdLabel Text="Default Purple"
NumberOfCharactersPerLine="14"
ColorScheme="Green"/>
Here we define a few of the available properties, We’re increasing the number of characters from 10 (the default) to 14 and we have also specified the Purple color scheme.
Multi Line
<lcd:LcdLabel Text="Multi-line" NumberOfTextLines="2" NumberOfCharactersPerLine="5" />
Here we have configured the LCD control to have two lines of text, each with 5 characters.
Alternate Sizes
<lcd:LcdLabel Text="{Binding Greeting}"
DotMatrix="Dos5X7"
NumberOfCharactersPerLine="24"
LineSpacing="10"
BorderSpace="10"
PixelSize="Pix4X4" />
Here we have a large LCD display.
Text is data-bound to the view models Greeting propertyDotMatrix is set to Dos5X7 (default Mat5X7)NumberOfCharactersPerLine is set to 24 (default 10)LineSpacing is set to 10 (default 2)BorderSpace is set to 10 (default 3)PixelSize is set to Pix4X4 (default Pix2X2)
Custom Pixel Size
<lcd:LcdLabel Text="Custom Pixels" NumberOfCharactersPerLine="13" PixelSize="PixCustom" PixelHeight="2" PixelWidth="8" />
Animations
You can animate the LCD contents by setting the IsAnimated property to True and using the animation properties to control various aspects of the animation behaviour.
<lcd:LcdLabel Text="{Binding Greeting}"
NumberOfCharactersPerLine="24"
ColorScheme="Green"
IsAnimated="True"
AnimationSpeed="10"
AnimationStyle="Loop"/>
The AnimationSpeed property controls the speed in FPS. The value used here is divided by 1000. The AnimationStyle property controls the overall behaviour of the animation. The two options are Loop and Contiguous. Looped content will cycle to completion whereas Contiguous content cycles the string in a continuous stream of characters.
Properties
ColorScheme PixelSize DotMatrix PixelSpacing CharacterSpacing LineSpacing BorderSpace NumberOfTextLines NumberOfCharactersPerLine PixelOnColor PixelOffColor LcdBackgroundColor PixelWidth PixelHeight Text HalfIntensity IsAnimated AnimationStyle AnimationSpeed
ColorScheme Options
Default Red Green Blue Purple LightBlue Yellow
DotMatrix Options
Mat5X7 Mat5X8 Mat7X9 Mat9X12 Hitachi Hitachi2 Dos5X7
PixelSize Options
Pix1X1 Pix2X2 Pix3X3 Pix4X4 Pix5X5 Pix6X6 Pix7X7 Pix8X8 Pix9X9 Pix10X10 Pix11X11 Pix12X12 Pix13X13 Pix14X14 Pix15X15 Pix16X16 Custom
AnimationStyle Options
Loop Contiguous
Introduction
This is a control providing a form of digital LCD segment display for use within a .NET AvaloniaUI applications.
How To Use The Control
Installation
Import Styles
The default style provided is very simple and be easily replaced.
Usage
We’re defining a basic default LCD label, nothing fancy.
Predefined Color Themes
Here we define a few of the available properties, We’re increasing the number of characters from 10 (the default) to 14 and we have also specified the Purple color scheme.
Multi Line
Here we have configured the LCD control to have two lines of text, each with 5 characters.
Alternate Sizes
Here we have a large LCD display.
Textis data-bound to the view modelsGreetingpropertyDotMatrixis set toDos5X7(defaultMat5X7)NumberOfCharactersPerLineis set to24(default10)LineSpacingis set to10(default2)BorderSpaceis set to10(default3)PixelSizeis set toPix4X4(defaultPix2X2)Custom Pixel Size
Animations
You can animate the LCD contents by setting the
IsAnimatedproperty toTrueand using the animation properties to control various aspects of the animation behaviour.The
AnimationSpeedproperty controls the speed in FPS. The value used here is divided by1000. TheAnimationStyleproperty controls the overall behaviour of the animation. The two options areLoopandContiguous. Looped content will cycle to completion whereas Contiguous content cycles the string in a continuous stream of characters.Properties
ColorSchemePixelSizeDotMatrixPixelSpacingCharacterSpacingLineSpacingBorderSpaceNumberOfTextLinesNumberOfCharactersPerLinePixelOnColorPixelOffColorLcdBackgroundColorPixelWidthPixelHeightTextHalfIntensityIsAnimatedAnimationStyleAnimationSpeedColorScheme Options
DefaultRedGreenBluePurpleLightBlueYellowDotMatrix Options
Mat5X7Mat5X8Mat7X9Mat9X12HitachiHitachi2Dos5X7PixelSize Options
Pix1X1Pix2X2Pix3X3Pix4X4Pix5X5Pix6X6Pix7X7Pix8X8Pix9X9Pix10X10Pix11X11Pix12X12Pix13X13Pix14X14Pix15X15Pix16X16CustomAnimationStyle Options
LoopContiguous