BarCodeSymbology Class
Provides the base class for a bar code symbology.
public abstract class BarCodeSymbology : FrameworkElement
- Inheritance:
- object Visual UIElement FrameworkElement object
Remarks
For detailed documentation on this symbology's features and how to use them, please see the Bar Code Symbology-related series of documentation topics.
Constructors
BarCodeSymbology()
Initializes a new instance of the BarCodeSymbology
class.
protected BarCodeSymbology()
Properties
Background
Gets or sets the Brush to use for rendering the background.
public Brush Background { get; set; }
Property Value
DisplayName
Gets the display name of the symbology.
Foreground
Gets or sets the Brush to use for rendering the foreground.
public Brush Foreground { get; set; }
Property Value
Value
Gets or sets the value to encode in the bar code.
[Localizability(LocalizationCategory.Label)]
public string Value { get; set; }
Property Value
- string:
The value to encode in the bar code.
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
Identifies the Background dependency property. This field is read-only.
public static readonly DependencyProperty BackgroundProperty
ForegroundProperty
Identifies the Foreground dependency property. This field is read-only.
public static readonly DependencyProperty ForegroundProperty
ValueProperty
Identifies the Value dependency property. This field is read-only.
public static readonly DependencyProperty ValueProperty