### Install MathConverter via Package Manager Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Commands to install the required NuGet packages for WPF or MAUI projects. ```powershell PM> Install-Package MathConverter PM> Install-Package MathConverter.Maui ``` -------------------------------- ### Basic MathConverter Setup in XAML Source: https://context7.com/hexinnovation/mathconverter/llms.txt Add MathConverter to your resources and use it with a Binding by specifying a ConverterParameter expression. ```xaml ``` -------------------------------- ### Perform Basic Math in Binding Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Examples of using MathConverter to perform arithmetic operations on binding values. ```xml ``` ```xml ``` -------------------------------- ### String Searching with StartsWith and Contains Source: https://context7.com/hexinnovation/mathconverter/llms.txt Check if a string starts with a specific prefix or contains a substring. The result can be used for conditional visibility. ```xaml ``` ```xaml ``` -------------------------------- ### Format Function Example Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Demonstrates the equivalence of interpolated strings and the Format function. The interpolated string $`Hello, {x}` is equivalent to Format('Hello, {0}', x). ```C# Format('Hello, {0}', x) ``` -------------------------------- ### Get Current Date and Time Source: https://context7.com/hexinnovation/mathconverter/llms.txt Retrieve the current date and time using the `Now()` function. The output can be formatted using string interpolation. ```xaml ``` -------------------------------- ### Perform Single Binding Conversion Source: https://github.com/hexinnovation/mathconverter/blob/main/Nuget README.md Use MathConverter for single binding conversions by specifying the conversion logic in the ConverterParameter. This example divides the ActualHeight by 2. ```xaml ``` -------------------------------- ### Specify Different Margins with MathConverter Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Use MathConverter with multiple values for types like Thickness by separating values with commas or semicolons in the ConverterParameter. This example sets different left/right and top/bottom margins. ```xaml ``` -------------------------------- ### String Interpolation with ConverterParameter Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Use ConverterParameter with string interpolation for dynamic text formatting in bindings. The example shows how to format a string based on a bound property 'NumClicks'. ```XAML ``` -------------------------------- ### MathConverter with Optional ConverterParameter Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md When ConverterParameter is omitted, MathConverter joins binding values with a comma. This example demonstrates creating different Thickness values from multiple bindings. ```xaml ``` ```xaml ``` -------------------------------- ### Get Type Information Source: https://context7.com/hexinnovation/mathconverter/llms.txt Retrieve the type of a given value using the `GetType` function. This is useful for runtime type checking or debugging. ```xaml ``` -------------------------------- ### Interpolated Strings Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Interpolated strings in MathConverter function similarly to C#, allowing dynamic string formatting. They must start and end with the same quote character. ```APIDOC ## Interpolated Strings Interpolated strings work the same way as they do in C#. The same rules apply: a string must start and end with the same character. ### Example ``` $"'Coordinates: ({x:N2},{y:N2}).'" $"The weather outside is {x}." `` $`Progress: {x:P} complete` `` ``` > **Note:** An interpolated string is a wrapper around a call to the `Format` function, so `$'Hello, {x}'` is equivalent to `Format('Hello, {0}', x)`. ``` -------------------------------- ### Use Convert MarkupExtension Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md A more concise syntax for performing multi-binding calculations using the math:Convert extension. ```xml CornerRadius="{math:Convert 'Min(x,y)/2', x={Binding ActualHeight}, y={Binding ActualWidth}}" ``` -------------------------------- ### String Formatting with Format Function Source: https://context7.com/hexinnovation/mathconverter/llms.txt Format strings using placeholders and format specifiers. The `x` parameter represents the value to be formatted. ```xaml ``` -------------------------------- ### Configure MathConverter Options Source: https://context7.com/hexinnovation/mathconverter/llms.txt Adjust caching behavior and unset value handling via XAML or C# properties. ```xaml ``` ```csharp // Clear cache programmatically var math = (MathConverter)FindResource("Math"); math.ClearCache(); // Check cache setting bool usesCaching = math.UseCache; // Disable caching at runtime math.UseCache = false; ``` -------------------------------- ### Error Handling with TryCatch Source: https://context7.com/hexinnovation/mathconverter/llms.txt Execute expressions sequentially and return the result of the first one that does not throw an exception. Useful for handling potential division by zero or other errors. ```xaml ``` -------------------------------- ### String Functions Source: https://context7.com/hexinnovation/mathconverter/llms.txt Functions for case conversion, searching, formatting, and joining strings. ```APIDOC ## String Functions ### Description Provides utilities for manipulating strings within XAML bindings, including case conversion, pattern matching, and formatting. ### Functions - **ToUpper(x)**: Converts string to uppercase. - **ToLower(x)**: Converts string to lowercase. - **StartsWith(x, pattern)**: Returns boolean if string starts with pattern. - **Contains(x, pattern)**: Returns boolean if string contains pattern. - **Format(format, x)**: Formats a string using standard .NET format strings. - **Concat(x, separator, y)**: Concatenates multiple values with a separator. - **Join(separator, ...args)**: Joins multiple arguments with a specified separator. ``` -------------------------------- ### Create Custom MathConverter Functions in C# Source: https://context7.com/hexinnovation/mathconverter/llms.txt Inherit from base classes like OneArgFunction, OneDoubleFunction, TwoArgFunction, or ArbitraryArgFunction to define custom logic. ```csharp // Custom function that takes one argument using HexInnovation; using System; using System.Globalization; public class GetWindowTitleFunction : OneArgFunction { public override object? Evaluate(CultureInfo cultureInfo, object? argument) { return argument is Type t && t.IsAssignableTo(typeof(Window)) ? ((Window)Activator.CreateInstance(t)!).Title : null; } } // Custom function with numeric input public class DoubleValueFunction : OneDoubleFunction { public override double? Evaluate(CultureInfo cultureInfo, double x) { return x * 2; } } // Custom function with two arguments public class PowerFunction : TwoArgFunction { public override object? Evaluate(CultureInfo cultureInfo, object? x, object? y) { if (TryConvert(x, out var baseVal) && TryConvert(y, out var exp)) return Math.Pow(baseVal, exp); return null; } } // Custom function with variable arguments public class SumFunction : ArbitraryArgFunction { public override object? Evaluate(CultureInfo cultureInfo, Func[] arguments) { double sum = 0; foreach (var arg in arguments) { if (TryConvert(arg(), out var value)) sum += value; } return sum; } public override bool IsValidNumberOfParameters(int numParams) => numParams >= 1; } ``` -------------------------------- ### Convert Markup Extension Syntax Source: https://context7.com/hexinnovation/mathconverter/llms.txt The math:Convert markup extension provides a more elegant syntax for MultiBinding scenarios, wrapping a MultiBinding internally. Up to 10 variables are supported. ```xaml ``` ```xaml ``` ```xaml ``` -------------------------------- ### Add MathConverter Resource Source: https://github.com/hexinnovation/mathconverter/blob/main/Nuget README.md Include the MathConverter as an Application resource to make it available throughout your application. The 'math' namespace must be defined. ```xaml The math namespace is defined as follows: ```xaml xmlns:math="http://hexinnovation.com/math" ``` ``` -------------------------------- ### Perform MultiBinding Math Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Using MultiBinding with MathConverter to perform calculations involving multiple source properties. ```xml ``` -------------------------------- ### Registering Custom Functions in MathConverter Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md This C# code demonstrates how to dynamically manage custom functions within MathConverter. It shows how to clear existing custom functions, register default ones, or remove a default function to add a custom implementation. Use this when you need to override or extend MathConverter's built-in mathematical capabilities. ```csharp private void RadioButton_Changed(object sender, RoutedEventArgs e) { if (FindResource("Math") is not HexInnovation.MathConverter math) return; if (UseStockFunction.IsChecked == true) { // Go back to the stock function. math.CustomFunctions.Clear(); math.CustomFunctions.RegisterDefaultFunctions(); } else { // Remove the default Average function and define our own. math.CustomFunctions.Remove("Average"); math.CustomFunctions.Add(CustomFunctionDefinition.Create("Average")); } // Tell the TextBlock to refresh its binding again. TextBlock?.GetBindingExpression(TextBlock.TextProperty).UpdateTarget(); } ``` -------------------------------- ### Perform Multi-Binding Conversion Source: https://github.com/hexinnovation/mathconverter/blob/main/Nuget README.md Handle conversions involving multiple bindings by using the math:Convert markup extension. Specify the conversion expression and bind values to parameters like 'x' and 'y'. ```xaml ``` -------------------------------- ### Define ListBox items with Types Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Demonstrates adding Type objects to a ListBox for use with custom converters. ```xaml ``` -------------------------------- ### Arithmetic Operators in MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt Use standard arithmetic operators like +, -, *, /, %, and ^ for exponentiation within XAML bindings. Ensure the converter resource is correctly defined. ```xaml ``` ```xaml ``` ```xaml ``` ```xaml ``` ```xaml ``` ```xaml ``` -------------------------------- ### MathConverter Functions Overview Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Lists common MathConverter functions like Now(), UnsetValue(), DoNothing(), and various mathematical operations. Functions are case-sensitive. ```C# Now() ``` ```C# UnsetValue() ``` ```C# DoNothing() ``` ```C# Cos(x) ``` ```C# Sin(x) ``` ```C# Tan(x) ``` ```C# Abs(x) ``` ```C# Acos(x) ``` ```C# ArcCos(x) ``` ```C# Asin(x) ``` ```C# ArcSin(x) ``` ```C# Atan(x) ``` ```C# ArcTan(x) ``` ```C# Ceil(x) ``` ```C# Ceiling(x) ``` ```C# Floor(x) ``` ```C# Sqrt(x) ``` ```C# Log(x, y) ``` ```C# Atan2(x, y) ``` ```C# ArcTan2(x, y) ``` ```C# Round(x) ``` ```C# Round(x, y) ``` ```C# Deg(x) ``` ```C# Degrees(x) ``` ```C# Rad(x) ``` ```C# Radians(x) ``` ```C# ToLower(x) ``` ```C# LCase(x) ``` ```C# ToUpper(x) ``` ```C# UCase(x) ``` ```C# TryParseDouble(x) ``` ```C# StartsWith(x, y) ``` ```C# EndsWith(x, y) ``` ```C# IsNull() ``` ```C# IfNull() ``` ```C# Coalesce() ``` ```C# And() ``` ```C# Or() ``` ```C# Nor() ``` ```C# Max() ``` ```C# Min() ``` ```C# Avg() ``` ```C# Average() ``` ```C# Format() ``` ```C# Concat() ``` ```C# Join() ``` ```C# GetType(x) ``` ```C# ConvertType(x, y) ``` -------------------------------- ### String Case Conversion Source: https://context7.com/hexinnovation/mathconverter/llms.txt Use ToUpper and ToLower to convert string case. Ensure the converter is correctly referenced as `StaticResource Math`. ```xaml ``` ```xaml ``` -------------------------------- ### Logical and Null Handling Functions Source: https://context7.com/hexinnovation/mathconverter/llms.txt Functions for boolean logic and handling null values in bindings. ```APIDOC ## Logical and Null Handling ### Description Enables conditional logic and null-coalescing behavior within XAML bindings. ### Functions - **And(x, y)**: Logical AND operation. - **Or(x, y)**: Logical OR operation. - **IsNull(x, fallback)**: Returns fallback if x is null. - **Coalesce(...args)**: Returns the first non-null value from the provided arguments. ``` -------------------------------- ### String Concatenation with Concat Source: https://context7.com/hexinnovation/mathconverter/llms.txt Concatenate multiple strings with an optional separator. Use `MultiBinding` to provide multiple string sources. ```xaml ``` -------------------------------- ### DateTime and Type Conversion Source: https://context7.com/hexinnovation/mathconverter/llms.txt Functions for working with dates, time arithmetic, and type casting. ```APIDOC ## DateTime and Type Conversion ### Description Utilities for date manipulation, type parsing, and enum comparisons. ### Functions - **Now()**: Returns current system time. - **ConvertType(value, type)**: Converts a value to a specific type. - **TryParseDouble(x)**: Attempts to parse a string to a double. - **GetType(x)**: Returns type information for the object. - **EnumEquals(x, enumValue)**: Compares an enum value against a string representation. ``` -------------------------------- ### Define MathConverter Resource Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Register the MathConverter as an application resource for use in XAML. ```xml ``` -------------------------------- ### Display average calculation in XAML Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Displays the result of the Average function within a TextBlock. ```xaml ``` -------------------------------- ### Throw Exception for Debugging Source: https://context7.com/hexinnovation/mathconverter/llms.txt Intentionally throw an exception with provided arguments. This is primarily for debugging purposes to halt execution and inspect state. ```xaml ``` -------------------------------- ### Thickness and Multi-Value Types Source: https://context7.com/hexinnovation/mathconverter/llms.txt Specify multiple values separated by commas or semicolons for complex types like Thickness, CornerRadius, or Rect. ```xaml ``` -------------------------------- ### Manage Custom Functions Programmatically Source: https://context7.com/hexinnovation/mathconverter/llms.txt Modify the CustomFunctions collection at runtime to add, remove, or replace functions and clear the expression cache. ```csharp // Get MathConverter from resources var math = (MathConverter)FindResource("Math"); // Add a custom function math.CustomFunctions.Add( CustomFunctionDefinition.Create("MyFunc")); // Remove a function by name math.CustomFunctions.Remove("Average"); // Replace a built-in function with custom implementation math.CustomFunctions.Remove("Average"); math.CustomFunctions.Add( CustomFunctionDefinition.Create("Average")); // Clear all and re-register defaults math.CustomFunctions.Clear(); math.CustomFunctions.RegisterDefaultFunctions(); // Clear the expression cache after modifying functions math.ClearCache(); // Force binding to refresh TextBlock.GetBindingExpression(TextBlock.TextProperty)?.UpdateTarget(); ``` -------------------------------- ### Built-in Functions Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md MathConverter provides a rich set of built-in functions for various operations. Functions are case-sensitive. ```APIDOC ## Built-in Functions Functions are case-sensitive. ### General Functions * `Now()`: Returns `System.DateTime.Now`. * `UnsetValue()`: Returns `DependencyProperty.UnsetValue` or `BindableProperty.UnsetValue`. * `DoNothing()`: Returns `Binding.DoNothing`. ### Mathematical Functions * `Cos(x)`, `Sin(x)`, `Tan(x)`, `Abs(x)`: Behave like their `System.Math` counterparts. * `Acos(x)`/`ArcCos(x)`, `Asin(x)`/`ArcSin(x)`, `Atan(x)`/`ArcTan(x)`: Inverse trigonometric functions. * `Ceil(x)`/`Ceiling(x)`, `Floor(x)`: Rounding functions. * `Sqrt(x)`: Square root. * `Log(x, y)`: Logarithm. * `Atan2(x, y)`/`ArcTan2(x, y)`: Arctangent of two numbers. * `Round(x)`/`Round(x, y)`: Rounds a number. * `Deg(x)`/`Degrees(x)`: Converts radians to degrees. * `Rad(x)`/`Radians(x)`: Converts degrees to radians. ### String Manipulation Functions * `ToLower(x)`/`LCase(x)`: Converts a string to lowercase. * `ToUpper(x)`/`UCase(x)`: Converts a string to uppercase. * `TryParseDouble(x)`: Attempts to convert `x` to a `double`. * `StartsWith(x, y)`: Checks if a string starts with a specified prefix. * `EndsWith(x, y)`: Checks if a string ends with a specified suffix. * `Contains(x, y)`: Checks if a string or collection contains a specified value. ### Logical and Conditional Functions * `IsNull()`/`IfNull()`/`Coalesce()`: Returns the first non-null argument. * `And()`, `Or()`, `Nor()`: Perform logical operations on multiple arguments. * `Max()`, `Min()`, `Avg()`/`Average()`: Return the maximum, minimum, or average of numeric values. ### Utility Functions * `Format()`: Equivalent to `string.Format`. * `Concat()`: Equivalent to `string.Concat`. * `Join()`: Equivalent to `string.Join`. * `GetType(x)`: Returns the type of `x`. * `ConvertType(x, y)`: Attempts to convert `x` to type `y` using `InvariantCulture`. ``` -------------------------------- ### Define Math Namespace Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Required XML namespace declaration for MathConverter. ```xml xmlns:math="http://hexinnovation.com/math" ``` -------------------------------- ### Joining Strings with a Separator Source: https://context7.com/hexinnovation/mathconverter/llms.txt Join a collection of strings into a single string using a specified separator. This is useful for creating comma-separated lists or similar. ```xaml ``` -------------------------------- ### Register Custom Functions in XAML Source: https://context7.com/hexinnovation/mathconverter/llms.txt Add custom function definitions to the MathConverter's CustomFunctions collection within XAML resources. ```xaml ``` -------------------------------- ### DateTime Arithmetic and Formatting Source: https://context7.com/hexinnovation/mathconverter/llms.txt Perform arithmetic operations on `DateTime` and `TimeSpan` values. Use `ConvertType` to cast values and format the output. ```xaml ``` -------------------------------- ### Error Handling Functions Source: https://context7.com/hexinnovation/mathconverter/llms.txt Functions for managing exceptions and binding updates. ```APIDOC ## Error Handling ### Description Provides mechanisms to handle errors gracefully or control binding updates. ### Functions - **TryCatch(expression, fallback)**: Executes expression and returns fallback if an exception occurs. - **Throw(message)**: Explicitly throws an exception. - **DoNothing()**: Returns Binding.DoNothing to skip the update. - **UnsetValue()**: Returns DependencyProperty.UnsetValue. ``` -------------------------------- ### Implement custom function in C# Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Defines a custom function by extending OneArgFunction and overriding the Evaluate method. ```csharp public class GetWindowTitleFunction : OneArgFunction { public override object? Evaluate(CultureInfo cultureInfo, object? argument) { return argument is Type t && t.IsAssignableTo(typeof(Window)) ? ((Window)Activator.CreateInstance(t)!).Title : null; } } ``` -------------------------------- ### Type Conversion with TryParseDouble Source: https://context7.com/hexinnovation/mathconverter/llms.txt Attempt to parse a string into a double. Use the null-coalescing operator `??` to provide a default value if parsing fails. ```xaml ``` -------------------------------- ### Logical Operators in MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt Employ logical operators && (AND), || (OR), and ! (NOT) for boolean expressions in XAML bindings. Note that for '&&' and '||', multiple bindings may be required. ```xaml ``` -------------------------------- ### MultiBinding with MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt Use MultiBinding to combine multiple values in a single expression. Access values using x, y, z for the first three bindings, or [0], [1], [2], etc. for any index. ```xaml ``` ```xaml ``` -------------------------------- ### Interpolated Strings in XAML Source: https://context7.com/hexinnovation/mathconverter/llms.txt Use the $ prefix in ConverterParameter to format strings with embedded expressions and format specifiers. ```xaml ``` -------------------------------- ### Math Functions in XAML Source: https://context7.com/hexinnovation/mathconverter/llms.txt Apply built-in math functions like trigonometry, rounding, and min/max within the ConverterParameter. Function names are case-sensitive. ```xaml ``` -------------------------------- ### Constants in MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt MathConverter supports mathematical constants like 'e' (Euler's number) and 'pi', as well as boolean constants 'true' and 'false', and 'null'. These can be used directly in expressions. ```xaml ``` ```xaml ``` -------------------------------- ### Register custom function in Resources Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Registers a custom function definition within the MathConverter resource. ```xaml ``` -------------------------------- ### Implicit Multiplication in MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt MathConverter supports implicit multiplication, allowing expressions like '2x' or 'x2y'. This can also be used with parentheses, such as '2(x+1)'. ```xaml ``` ```xaml ``` ```xaml ``` -------------------------------- ### Comparison Operators in MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt Utilize comparison operators such as ==, !=, <, >, <=, and >= within XAML bindings for conditional logic. These are often used with the ternary operator. ```xaml ``` ```xaml ``` -------------------------------- ### Coalesce with Multiple Fallbacks Source: https://context7.com/hexinnovation/mathconverter/llms.txt Chain multiple fallback values for null coalescing. The function returns the first non-null value from the provided arguments. ```xaml ``` -------------------------------- ### Boolean to Visibility Conversion with MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt Convert boolean values to Visibility enum values using ternary expressions. Strings in expressions can use backticks, single quotes, or double quotes. ```xaml ``` ```xaml ``` ```xaml ``` -------------------------------- ### Perform time calculations in XAML Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Uses ConvertType to convert a string to TimeSpan and adds it to the current time. ```xaml ``` -------------------------------- ### Logical AND/OR Operations Source: https://context7.com/hexinnovation/mathconverter/llms.txt Perform logical AND and OR operations on boolean values. The result can control UI element properties like `IsEnabled` or `Visibility`. ```xaml ``` ```xaml ``` -------------------------------- ### Enum Comparison Source: https://context7.com/hexinnovation/mathconverter/llms.txt Compare an enum value against a string representation of an enum member. Returns a boolean result for conditional logic. ```xaml ``` -------------------------------- ### Replace VisibleOrHidden function Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Use a ternary expression to replicate the functionality of the removed VisibleOrHidden function. ```text x ? `Visible` : `Hidden` ``` -------------------------------- ### Interpolated Strings in MathConverter Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md MathConverter supports interpolated strings within the ConverterParameter for dynamic string formatting, similar to C#. ```xaml ``` -------------------------------- ### Apply custom function in DataTemplate Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Uses a custom function within a DataTemplate to convert Type objects to display values. ```xaml ``` -------------------------------- ### Null Coalescing with IsNull Source: https://context7.com/hexinnovation/mathconverter/llms.txt Provide a fallback value when a binding is null. The `x` parameter is the value to check, and the second parameter is the fallback. ```xaml ``` -------------------------------- ### Disabling MathConverter Cache Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md This XAML snippet shows how to disable the caching mechanism for a MathConverter instance. Set UseCache to "False" when you want to prevent MathConverter from storing parsed AbstractSyntaxTrees, which can be useful for managing memory, especially when using a single MathConverter instance across a large application. ```xaml ``` -------------------------------- ### Convert Boolean to Visibility with MathConverter Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Use the ternary operator within ConverterParameter to convert a boolean binding to a Visibility value. Strings within the parameter can be delimited by double quotes, single quotes, or grave accents. ```xaml ``` -------------------------------- ### Skip Update with DoNothing Source: https://context7.com/hexinnovation/mathconverter/llms.txt Return `Binding.DoNothing` to prevent the binding target from being updated. This is useful when a condition is met that should not trigger a UI change. ```xaml ``` -------------------------------- ### Null Coalescing Operator in MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt Use the null coalescing operator (??) to provide a default value when a binding source is null. This is useful for handling potentially missing data. ```xaml ``` -------------------------------- ### Return UnsetValue Source: https://context7.com/hexinnovation/mathconverter/llms.txt Return `DependencyProperty.UnsetValue` to indicate that the binding value is not available or should not be applied. This can reset the property to its default value. ```xaml ``` -------------------------------- ### Replace VisibleOrCollapsed function Source: https://github.com/hexinnovation/mathconverter/blob/main/README.md Use a ternary expression to replicate the functionality of the removed VisibleOrCollapsed function. ```text x ? `Visible` : `Collapsed` ``` -------------------------------- ### Ternary Operator in MathConverter Source: https://context7.com/hexinnovation/mathconverter/llms.txt The ternary operator (condition ? value_if_true : value_if_false) is supported for concise conditional assignments within XAML bindings. Nested ternary operators are also allowed. ```xaml ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.