Skip to content

DiGi.UI.WPF

github-actions[bot] edited this page Jul 15, 2026 · 2 revisions

DiGi.UI.WPF Namespace

Classes

Create Class

public static class Create

Inheritance System.Object → Create

Methods

Create.BitmapImage(int, int, Color) Method

Creates a solid color System.Windows.Media.Imaging.BitmapImage with the specified dimensions.

public static System.Windows.Media.Imaging.BitmapImage BitmapImage(int width, int height, System.Drawing.Color color);

Parameters

width System.Int32

The width of the resulting image in pixels.

height System.Int32

The height of the resulting image in pixels.

color System.Drawing.Color

The System.Drawing.Color to fill the image with.

Returns

System.Windows.Media.Imaging.BitmapImage
A System.Windows.Media.Imaging.BitmapImage representing a solid color rectangle.

Create.BitmapImage(Image) Method

Converts a System.Drawing.Image object into a System.Windows.Media.Imaging.BitmapImage.

public static System.Windows.Media.Imaging.BitmapImage? BitmapImage(System.Drawing.Image? image);

Parameters

image System.Drawing.Image

The source image to convert.

Returns

System.Windows.Media.Imaging.BitmapImage
A System.Windows.Media.Imaging.BitmapImage created from the provided image, or null if the input is null.

Create.BitmapImage(this byte[]) Method

Converts a byte array into a System.Windows.Media.Imaging.BitmapImage.

public static System.Windows.Media.Imaging.BitmapImage? BitmapImage(this byte[]? bytes);

Parameters

bytes System.Byte[]

The byte array containing the image data.

Returns

System.Windows.Media.Imaging.BitmapImage
A System.Windows.Media.Imaging.BitmapImage created from the provided bytes, or null if the input is null.

Create.VisualBackgroundTask(IBackgroundTask, string, string) Method

Creates a visual wrapper for the specified background task, automatically determining if it is reportable to provide the appropriate visual implementation.

public static DiGi.UI.WPF.Interfaces.IVisualBackgroundTask VisualBackgroundTask(DiGi.Core.Interfaces.IBackgroundTask backgroundTask, string name, string description);

Parameters

backgroundTask DiGi.Core.Interfaces.IBackgroundTask

The background task instance to be wrapped.

name System.String

The display name of the task.

description System.String

A description of the task's operation.

Returns

IVisualBackgroundTask
An implementation of IVisualBackgroundTask that provides visual tracking for the background task.

Exceptions

System.ArgumentNullException
Thrown when backgroundTask is null.

Modify Class

public static class Modify

Inheritance System.Object → Modify

Methods

Modify.CollapseAll(this ItemCollection, bool) Method

Collapses all items in the specified item collection.

public static void CollapseAll(this System.Windows.Controls.ItemCollection itemCollection, bool inverse=false);

Parameters

itemCollection System.Windows.Controls.ItemCollection

The System.Windows.Controls.ItemCollection to collapse.

inverse System.Boolean

A boolean value indicating whether to invert the operation (expand instead of collapse).

Modify.ExpandAll(this ItemCollection, bool) Method

Recursively expands or collapses all items within the specified System.Windows.Controls.ItemCollection.

public static void ExpandAll(this System.Windows.Controls.ItemCollection itemCollection, bool inverse=false);

Parameters

itemCollection System.Windows.Controls.ItemCollection

The collection of items to be expanded or collapsed.

inverse System.Boolean

If set to true, all items will be collapsed instead of expanded. Defaults to false.

Modify.Update(this ItemCollection, ItemPath, Func<ItemPath,ItemPathTreeViewItem>) Method

Updates or creates a tree view item based on the provided path within an item collection.

public static DiGi.UI.WPF.Classes.ItemPathTreeViewItem? Update(this System.Windows.Controls.ItemCollection? itemCollection, DiGi.UI.WPF.Classes.ItemPath? path, System.Func<DiGi.UI.WPF.Classes.ItemPath?,DiGi.UI.WPF.Classes.ItemPathTreeViewItem?>? createFunc);

Parameters

itemCollection System.Windows.Controls.ItemCollection

The collection of items to search or update.

path ItemPath

The target path for the tree view item.

createFunc System.Func<ItemPath,ItemPathTreeViewItem>

A function used to create a new tree view item if it does not exist at the specified path.

Returns

ItemPathTreeViewItem
The updated or created ItemPathTreeViewItem, or null if the operation failed or inputs were null.

Modify.Update(this ItemCollection, ItemPath, Func<ItemPath,ItemPathTreeViewItem>, ItemPath) Method

Updates or creates a tree view item based on the provided path within an item collection, optionally specifying a parent path for recursive traversal.

public static DiGi.UI.WPF.Classes.ItemPathTreeViewItem? Update(this System.Windows.Controls.ItemCollection? itemCollection, DiGi.UI.WPF.Classes.ItemPath? path, System.Func<DiGi.UI.WPF.Classes.ItemPath?,DiGi.UI.WPF.Classes.ItemPathTreeViewItem?>? createFunc, DiGi.UI.WPF.Classes.ItemPath? parentPath);

Parameters

itemCollection System.Windows.Controls.ItemCollection

The collection of items to search or update.

path ItemPath

The target path for the tree view item.

createFunc System.Func<ItemPath,ItemPathTreeViewItem>

A function used to create a new tree view item if it does not exist at the specified path.

parentPath ItemPath

The path of the parent item, used during recursive updates to track depth and hierarchy.

Returns

ItemPathTreeViewItem
The updated or created ItemPathTreeViewItem, or null if the operation failed or inputs were null.

Modify.Write(BitmapImage) Method

Writes the specified bitmap image to a file using a save file dialog.

public static bool Write(System.Windows.Media.Imaging.BitmapImage? bitmapImage);

Parameters

bitmapImage System.Windows.Media.Imaging.BitmapImage

The bitmap image to save.

Returns

System.Boolean
True if the write operation was successful; otherwise, false.

Modify.Write(BitmapImage, string) Method

Writes the specified bitmap image to a file at the given path.

public static bool Write(System.Windows.Media.Imaging.BitmapImage? bitmapImage, string? path);

Parameters

bitmapImage System.Windows.Media.Imaging.BitmapImage

The bitmap image to save.

path System.String

The destination file path.

Returns

System.Boolean
True if the write operation was successful; otherwise, false.

Modify.Write(BitmapImage, string) Method

Writes the specified bitmap image to a file using a save file dialog to determine the destination path.

public static bool Write(System.Windows.Media.Imaging.BitmapImage? bitmapImage, out string? path);

Parameters

bitmapImage System.Windows.Media.Imaging.BitmapImage

The bitmap image to save.

path System.String

When this method returns, contains the path of the file that was saved, or null if the operation failed.

Returns

System.Boolean
True if the write operation was successful; otherwise, false.

Query Class

public static class Query

Inheritance System.Object → Query

Methods

Query.BitmapEncoder(this FileFilter) Method

Determines the appropriate BitmapEncoder(this FileFilter) based on the file extensions provided in the specified file filter.

public static System.Windows.Media.Imaging.BitmapEncoder? BitmapEncoder(this DiGi.Core.IO.Classes.FileFilter? fileFilter);

Parameters

fileFilter DiGi.Core.IO.Classes.FileFilter

The file filter containing the list of extensions to evaluate.

Returns

System.Windows.Media.Imaging.BitmapEncoder
A BitmapEncoder(this FileFilter) instance (such as System.Windows.Media.Imaging.JpegBitmapEncoder or System.Windows.Media.Imaging.PngBitmapEncoder) if a matching image extension is found; otherwise, null.

Query.FileFilter(string) Method

Determines the appropriate file filter based on the provided file path's extension.

public static DiGi.Core.IO.Classes.FileFilter? FileFilter(string? path);

Parameters

path System.String

The path of the file to evaluate.

Returns

DiGi.Core.IO.Classes.FileFilter
A FileFilter(string) instance if a matching filter is found; otherwise, null.

Query.Parent<T>(DependencyObject) Method

Retrieves the parent System.Windows.Controls.ItemsControl of a given System.Windows.DependencyObject.

public static T? Parent<T>(System.Windows.DependencyObject? dependencyObject)
    where T : System.Windows.Controls.ItemsControl;

Type parameters

T

The type of the System.Windows.Controls.ItemsControl to return.

Parameters

dependencyObject System.Windows.DependencyObject

The dependency object for which to find the parent container.

Returns

T
The parent System.Windows.Controls.ItemsControl cast to T, or null if no such parent exists or the input is null.

Query.Path(this Window, FileFilter, bool) Method

Opens an open file dialog to select a file using a provided file filter and optionally including all files.

public static string? Path(this System.Windows.Window? window, DiGi.Core.IO.Classes.FileFilter? fileFilter=null, bool allFiles=false);

Parameters

window System.Windows.Window

The owner window for the dialog.

fileFilter DiGi.Core.IO.Classes.FileFilter

An optional DiGi.Core.IO.Classes.FileFilter used to filter the files.

allFiles System.Boolean

A boolean indicating whether to include a filter for all files (*.*).

Returns

System.String
The full path of the selected file, or null if the dialog was cancelled or closed.

Query.Path(this Window, string, string) Method

Opens an open file dialog to select a file based on a specific type name and extension.

public static string? Path(this System.Windows.Window? window, string fileTypeName, string fileExtension);

Parameters

window System.Windows.Window

The owner window for the dialog.

fileTypeName System.String

The descriptive name of the file type.

fileExtension System.String

The file extension to filter by.

Returns

System.String
The full path of the selected file, or null if the dialog was cancelled or closed.

Query.Path(this Window, string, IEnumerable<FileFilter>) Method

Opens an open file dialog to select a file using a custom title and a collection of file filters.

public static string? Path(this System.Windows.Window? window, string? title, System.Collections.Generic.IEnumerable<DiGi.Core.IO.Classes.FileFilter>? fileFilters);

Parameters

window System.Windows.Window

The owner window for the dialog.

title System.String

An optional custom title for the dialog window.

fileFilters System.Collections.Generic.IEnumerable<DiGi.Core.IO.Classes.FileFilter>

A collection of DiGi.Core.IO.Classes.FileFilter objects to define the file selection filters.

Returns

System.String
The full path of the selected file, or null if the dialog was cancelled or closed.

Query.Paths(this Window, string, string) Method

Opens an open file dialog to select one or more files based on the specified type name and extension.

public static string[]? Paths(this System.Windows.Window window, string fileTypeName, string fileExtension);

Parameters

window System.Windows.Window

The owner window that will display the dialog.

fileTypeName System.String

The descriptive name of the file type to be displayed in the dialog title and filter.

fileExtension System.String

The file extension used for filtering files (e.g., "txt").

Returns

System.String[]
An array of strings containing the paths of the selected files, or null if the dialog was cancelled or closed.

Query.ShowProgress(this Action, ProgressBarControl, string) Method

Executes the specified action while displaying indeterminate progress on the provided progress bar control.

public static void ShowProgress(this System.Action? action, DiGi.UI.WPF.Controls.ProgressBarControl? progressBarControl, string? text=null);

Parameters

action System.Action

The action to be executed.

progressBarControl ProgressBarControl

The progress bar control used to display progress.

text System.String

The optional text to display associated with the progress operation.

Query.ShowProgress(this Action, Window, string) Method

Executes the specified action while displaying an indeterminate progress window.

public static void ShowProgress(this System.Action action, System.Windows.Window? owner=null, string? text=null);

Parameters

action System.Action

The action to be executed.

owner System.Windows.Window

The optional owner window for the progress window.

text System.String

The optional text to display in the progress window.

Query.ShowProgress(this Action<IDeterminateWorker>, ProgressBarControl, string) Method

Executes the specified action that requires a worker with determinate progress using the provided progress bar control.

public static void ShowProgress(this System.Action<DiGi.Core.Interfaces.IDeterminateWorker>? action, DiGi.UI.WPF.Controls.ProgressBarControl? progressBarControl, string? text=null);

Parameters

action System.Action<DiGi.Core.Interfaces.IDeterminateWorker>

The action to be executed, receiving the determinate worker instance.

progressBarControl ProgressBarControl

The progress bar control used to display progress.

text System.String

The optional text to display associated with the progress operation.

Query.ShowProgress(this Action<IDeterminateWorker>, string) Method

Executes the specified action that requires a worker with determinate progress while displaying a progress window.

public static void ShowProgress(this System.Action<DiGi.Core.Interfaces.IDeterminateWorker>? action, string? text=null);

Parameters

action System.Action<DiGi.Core.Interfaces.IDeterminateWorker>

The action to be executed, receiving the determinate worker instance.

text System.String

The optional text to display in the progress window.

Query.ShowProgress(this Action<IIndeterminateWorker>, ProgressBarControl, string) Method

Executes the specified action that requires a worker with indeterminate progress using the provided progress bar control.

public static void ShowProgress(this System.Action<DiGi.Core.Interfaces.IIndeterminateWorker>? action, DiGi.UI.WPF.Controls.ProgressBarControl? progressBarControl, string? text=null);

Parameters

action System.Action<DiGi.Core.Interfaces.IIndeterminateWorker>

The action to be executed, receiving the indeterminate worker instance.

progressBarControl ProgressBarControl

The progress bar control used to display progress.

text System.String

The optional text to display associated with the progress operation.

Query.ShowProgress(this Action<IIndeterminateWorker>, Window, string) Method

Executes the specified action that requires a worker with indeterminate progress while displaying a progress window.

public static void ShowProgress(this System.Action<DiGi.Core.Interfaces.IIndeterminateWorker>? action, System.Windows.Window? owner=null, string? text=null);

Parameters

action System.Action<DiGi.Core.Interfaces.IIndeterminateWorker>

The action to be executed, receiving the indeterminate worker instance.

owner System.Windows.Window

The optional owner window for the progress window.

text System.String

The optional text to display in the progress window.

Query.TagItems<TItem,UControl>(this ItemCollection, bool, bool, Func<UControl,bool>) Method

Extracts items stored in the Tag property of controls within an ItemCollection, optionally including nested collections and filtering by selection criteria.

public static System.Collections.Generic.List<TItem>? TagItems<TItem,UControl>(this System.Windows.Controls.ItemCollection itemCollection, bool includeNested=true, bool selected=false, System.Func<UControl,bool>? selectedFunc=null)
    where UControl : System.Windows.Controls.Control;

Type parameters

TItem

The type of the item to be retrieved from the Tag property.

UControl

The specific control type to look for within the collection.

Parameters

itemCollection System.Windows.Controls.ItemCollection

The ItemCollection to process.

includeNested System.Boolean

If set to true, recursively processes nested ItemsControls. Defaults to true.

selected System.Boolean

If set to true, only items from controls that satisfy the selectedFunc are included. Defaults to false.

selectedFunc System.Func<UControl,System.Boolean>

The function used to evaluate if a control is selected. This must be provided if selected is set to true.

Returns

System.Collections.Generic.List<TItem>
A list of items found in the tags, or null if the provided itemCollection is null.

Clone this wiki locally