Skip to content

Extensions

Håvard Moås edited this page Jun 8, 2020 · 2 revisions

ObjectExtensions

GetPropertyValue()

Uses reflection to get an property value of an object using only an string as an identifier. This is to get the appropriate value for RadioButtonGroup.DisplayMemberPath.

ExtractDouble

Tries to extract a double value from a property on an object. If the property is not a double value,it will use the ToString(). If the ToString is not a double value it will use the defaultValue parameter.

CultureInfoExtensions

IsNorwegian

Checks if the current culture is norwegian, will return a boolean value.

DateTimeExtensions

IsToday

Checks if the date occurred to day, will return a boolean value.

IsYesterday

Checks if the date occurred yesterday, will return a boolean value.

IsTomorrow

Checks if the

date occurs tomorrow, will return a boolean value.

GetEnglishDaySuffix

Gets the correct day suffix for a date in English.

Examples

1st, 2nd, 3rd, 4th

PositionExtensions

GetX

Gets the x position relative to relativeParent of item.

GetY

Gets the y position relative to relativeParent of item.

CalculateRelativePosition

Calculates the relative position of the value regarding max and min.

VisualElementExtensions

GetParentOfType

Gets the parent of a certain type or returns null if no such parent is found above this item.

FromIdentifier (for all DIPS Colors identifiers)

Returns a Color from it's enum identification

usage :

var color = DIPS.Xamarin.UI.Resources.Colors.Theme.Identifier.TealPrimary.FromIdentifier();