Class CommonExtensions
A collection of generic extensions used across the codebase.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.WinControls.RadDiagram.dll
Syntax
public static class CommonExtensions
Methods
AddRange<T>(ICollection<T>, IEnumerable<T>)
Adds the given range of items to the current collection.
Declaration
public static void AddRange<T>(this ICollection<T> collection, IEnumerable<T> newItems)
Parameters
System. A collection to be augmented with the given items. |
System. The new items to add. |
Type Parameters
T
|
Exceptions
System. Will be raised if either the |
ClearIfSet(RadObject, RadProperty)
Clears the property if a value has been set.
Declaration
public static bool ClearIfSet(this RadObject dependencyObject, RadProperty dependencyProperty)
Parameters
Rad The dependency object. |
Rad The dependency property to clear. |
Returns
System. Returns |
Exceptions
System. Will be raised if either the |
Clone(IEnumerable<Double>)
Clones the list of doubles and returns a Double
Declaration
public static List<double> Clone(this IEnumerable<double> doubles)
Parameters
System. The list to clone. |
Returns
System. The cloned list. |
See Also
Clone(DoubleCollection)
Clones the list of doubles and returns a Double
Declaration
public static DoubleCollection Clone(this DoubleCollection doubles)
Parameters
Double The list to clone. |
Returns
Double The cloned list. |
See Also
Clone<T>(IEnumerable<T>)
Clones the list.
Declaration
public static IList<T> Clone<T>(this IEnumerable<T> list)
Parameters
System. The list to clone. |
Returns
System. The cloned list. |
Type Parameters
T
The data type of the list. |
Exceptions
System. Will be raised if the underlying |
ContainsAny<T>(IEnumerable<T>, IEnumerable<T>)
Checks for the occurrence of the given items in the collection.
Declaration
public static bool ContainsAny<T>(this IEnumerable<T> collection, IEnumerable<T> otherCollection)
Parameters
System. A collection to be tested for the given items. |
System. The other collection. |
Returns
System.
|
Type Parameters
T
|
Exceptions
System. Will be raised if either the |
EnsureListCount<T>(IList<T>, Int32, Func<T>)
Ensures the list has exactly the amount of items specified.
Declaration
public static bool EnsureListCount<T>(this IList<T> list, int count, Func<T> factory)
Parameters
System. The list to check. |
System. The expected count. |
System. The factory function if more items need to be created. |
Returns
System. Returns |
Type Parameters
T
The data type of the list. |
Exceptions
System. Will be raised if the underlying |
EnsureListCountAtLeast<T>(IList<T>, Int32, Func<T>)
Ensures that the list contains at least the amount of specified items. If not, the given factory function will be used to add additional items till the expect count is reached.
Declaration
public static bool EnsureListCountAtLeast<T>(this IList<T> list, int count, Func<T> factory)
Parameters
System. The list to check. |
System. The expected count. |
System. The factory function if more items need to be created. |
Returns
System. Returns |
Type Parameters
T
The data type of the list. |
Exceptions
System. Will be raised if the underlying |
ForEach<T>(IEnumerable<T>, Action<T>)
Executes the action for each item in the collection.
Declaration
public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
Parameters
System. The collection to iterate. |
System. The action to execute on each item. |
Type Parameters
T
|
Exceptions
System. Will be raised if either the |
GetActualBounds(IDiagramItem, Boolean)
Gets the Actual
Declaration
public static Rect GetActualBounds(this IDiagramItem item, bool isShapeActualBounds = true)
Parameters
IDiagram An IDiagram |
System. Indicates whether to get the actual (rotated) shape bounds or the normal bounds. |
Returns
GetActualBoundsWithoutTransform(IDiagramItem)
Gets the Actual
Declaration
public static Rect GetActualBoundsWithoutTransform(this IDiagramItem item)
Parameters
IDiagram An IDiagram |
Returns
GetActualBoundsWithRotationTransform(IDiagramItem)
Gets the Actual
Declaration
public static Rect GetActualBoundsWithRotationTransform(this IDiagramItem item)
Parameters
IDiagram An IDiagram |
Returns
GetEnclosingBounds(IEnumerable<IDiagramItem>, Boolean, Boolean, Boolean)
Gets the enclosing bounds of the list of diagram items.
Declaration
public static Rect GetEnclosingBounds(this IEnumerable<IDiagramItem> items, bool isGraphVirtualized = false, bool isShapeActualBounds = true, bool useControlBoundingRectangle = false)
Parameters
System. The diagram items. |
System. If set to |
System. Indicates whether to get the actual (rotated) shape bounds or the normal bounds. |
System. useControlBoundingRectangle |
Returns
GetEnclosingBoundsRotated(IEnumerable<IDiagramItem>)
Gets the enclosing bounds of the list of diagram items.
Declaration
public static Rect GetEnclosingBoundsRotated(this IEnumerable<IDiagramItem> items)
Parameters
System. The diagram items. |
Returns
GetEnclosingBoundsWithoutTransform(IEnumerable<IDiagramItem>, Boolean, Boolean, Boolean)
Gets the enclosing bounds of the list of diagram items.
Declaration
public static Rect GetEnclosingBoundsWithoutTransform(this IEnumerable<IDiagramItem> items, bool isGraphVirtualized = false, bool isShapeActualBounds = true, bool useControlBoundingRectangle = false)
Parameters
System. The diagram items. |
System. If set to |
System. Indicates whether to get the actual (rotated) shape bounds or the normal bounds. |
System.
|
Returns
Rect
enclosingBounds |
IsLocalValueSet(RadObject, RadProperty)
Determines whether the specified dependency property local value is set.
Declaration
public static bool IsLocalValueSet(this RadObject dependencyObject, RadProperty property)
Parameters
Rad The dependency object. |
Rad The property. |
Returns
System.
|
See Also
RemoveLast<T>(IList<T>)
Removes the last item in the list.
Declaration
public static void RemoveLast<T>(this IList<T> list)
Parameters
System. The list. |
Type Parameters
T
The data type of the list. |
Exceptions
System. Will be raised if the underlying |
SetIfDifferent(RadObject, RadProperty, Object)
Sets the value of the dependencyProperty
property if it's hasn't that value currently.
Declaration
public static bool SetIfDifferent(this RadObject dependencyObject, RadProperty dependencyProperty, object value)
Parameters
Rad The dependency object. |
Rad The dependency property. |
System. The value to set if currently different. |
Returns
System. Return |
Exceptions
System. Will be raised if either the |