BarCodeSymbology Class
Provides the base class for a bar code symbology.
public abstract class BarCodeSymbology : FrameworkElement
- Inheritance:
- object Visual UIElement FrameworkElement object
Constructors
BarCodeSymbology()
Initializes an instance of the class.
protected BarCodeSymbology()
Properties
Background
The Brush to use for rendering the background.
DisplayName
The display name of the symbology.
Foreground
The Brush to use for rendering the foreground.
Value
The value to encode in the bar code.
[Localizability(LocalizationCategory.Label)]
public string? Value { get; set; }
Property Value
Methods
MeasureDesiredSize(Size?)
Measures the desired size of the symbology, based on the specified available size.
public Size? MeasureDesiredSize(Size? availableSize)
| Parameter | Type | Description |
|---|---|---|
| availableSize | Size | The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available. |
Returns
- Size:
The size that this element determines it needs during layout, based on its calculations of child element sizes.
MeasureOverride(Size?)
When overridden in a derived class, measures the size in layout required for child elements and determines a size for the FrameworkElement-derived class.
protected override Size? MeasureOverride(Size? availableSize)
| Parameter | Type | Description |
|---|---|---|
| availableSize | Size | The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available. |
Returns
- Size:
The size that this element determines it needs during layout, based on its calculations of child element sizes.
OnRender(DrawingContext)
When overridden in a derived class, participates in rendering operations that are directed by the layout system. The rendering instructions for this element are not used directly when this method is invoked, and are instead preserved for later asynchronous use by layout and drawing.
protected override void OnRender(DrawingContext drawingContext)
| Parameter | Type | Description |
|---|---|---|
| drawingContext | DrawingContext | The drawing instructions for a specific element. This context is provided to the layout system. |
OnValueChanged(string?, string?)
Occurs when the value of the Value property is changed.
protected virtual void OnValueChanged(string? oldValue, string? newValue)
| Parameter | Type | Description |
|---|---|---|
| oldValue | string | The old value. |
| newValue | string | The new value. |
Render(DrawingContext, Point, Size)
Renders the symbology to the specified DrawingContext.
public abstract void Render(DrawingContext drawingContext, Point location, Size size)
| Parameter | Type | Description |
|---|---|---|
| drawingContext | DrawingContext | The DrawingContext upon which to render the symbology. |
| location | Point | The location at which to draw the bar code. |
| size | Size | The size of the bar code to draw. |
ToBitmap(double, double)
Creates a BitmapSource based on the contents of the symbology.
public BitmapSource? ToBitmap(double dpiX, double dpiY)
| Parameter | Type | Description |
|---|---|---|
| dpiX | double | The x DPI. |
| dpiY | double | The y DPI. |
Returns
- BitmapSource:
The BitmapSource that was created.
Remarks
It is recommended that this symbology not have a visual parent when calling this method.
ValidateValue(string?)
Validates that the symbology can parse the specified value.
public abstract ValidationResult ValidateValue(string? value)
| Parameter | Type | Description |
|---|---|---|
| value | string | The value to validate. |
Returns
- ValidationResult:
A ValidationResult containing the result of the validation.
Fields
BackgroundProperty
Defines the Background property.
public static readonly DependencyProperty BackgroundProperty
ForegroundProperty
Defines the Foreground property.
public static readonly DependencyProperty ForegroundProperty
ValueProperty
Defines the Value property.
public static readonly DependencyProperty ValueProperty