Class Measurement
- Namespace
- Tudormobile.Strava.UI.Controls
- Assembly
- Tudormobile.Strava.UI.dll
Represents a UI element that displays a measurement value, with support for unit conversion based on user preferences.
public class Measurement : TextBlock, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IServiceProvider, IContentHost, IAddChild
- Inheritance
-
Measurement
- Implements
- Derived
- Inherited Members
Remarks
The Measurement class extends TextBlock to provide functionality for displaying measurement values in a user-preferred unit system. The measurement value is always stored internally in meters, but it can be displayed in different units (e.g., feet, kilometers) based on the attached PreferenceProperty.
Fields
PreferenceProperty
Identifies the attached property that specifies the measurement preference for a control.
public static readonly DependencyProperty PreferenceProperty
Field Value
Remarks
This attached property allows controls to specify whether measurements should be displayed in feet or meters. The default value is feet.
ValueProperty
The dependency property for the measurement value.
public static readonly DependencyProperty ValueProperty
Field Value
Properties
Value
The measurement value, in meters.
public double Value { get; set; }
Property Value
Remarks
This value is always in meters, regardless of the preference set.
Methods
GetPreference(DependencyObject)
Retrieves the MeasurementPreference value associated with the specified DependencyObject.
public static MeasurementPreference GetPreference(DependencyObject obj)
Parameters
objDependencyObjectThe DependencyObject from which to retrieve the preference value.
Returns
- MeasurementPreference
The MeasurementPreference value currently set on the specified
obj.
SetPreference(DependencyObject, MeasurementPreference)
Sets the measurement preference for the specified dependency object.
public static void SetPreference(DependencyObject obj, MeasurementPreference value)
Parameters
objDependencyObjectThe DependencyObject for which the measurement preference is being set. Cannot be null.
valueMeasurementPreferenceThe MeasurementPreference value to set.