Evenementer
Mar 17, 9 PM - Mar 21, 10 AM
Maacht mat bei der Meetup-Serie, fir skaléierbar KI-Léisungen op Basis vu realistesche Benotzungsfäll mat aneren Entwéckler an Experten ze bauen.
Elo umellenDëse Browser gëtt net méi ënnerstëtzt.
Upgrat op Microsoft Edge fir vun de Virdeeler vun leschten Eegeschaften, Sécherheetsupdaten, an techneschem Support ze profitéieren.
CommunityToolkit.Maui.Options
allows developers to customize CommunityToolkit.Maui
. The toolkit may behave different depends on these settings.
Options
should be assigned at startup when calling .UseMauiCommunityToolkit()
:
var builder = MauiApp.CreateBuilder();
builder.UseMauiCommunityToolkit(options =>
{
options.SetShouldSuppressExceptionsInConverters(false);
options.SetShouldSuppressExceptionsInBehaviors(false);
options.SetShouldSuppressExceptionsInAnimations(false);
})
When set to true
, if a converter implementing CommunityToolkit.Maui.Converters.BaseConverter
throws an Exception
, the Exception
will be caught, logged via Debug.WriteLine()
, and a predetermined default value will be returned.
Default value is false
.
This option is enabled when calling .UseMauiCommunityToolkit()
:
var builder = MauiApp.CreateBuilder();
builder.UseMauiCommunityToolkit(options =>
{
options.SetShouldSuppressExceptionsInConverters(true);
})
When set to true
, a default value will be returned when a Converter
throws an Exception
.
Two default values are included:
public object? ICommunityToolkitValueConverter.DefaultConvertReturnValue { get; set; }
Default value returned when Convert(object? value, Type targetType, object? parameter, CultureInfo? culture)
throws an Exception
public object ICommunityToolkitValueConverter.DefaultConvertBackReturnValue { get; set; }
Default value returned when ConvertBack(object? value, Type targetType, object? parameter, CultureInfo? culture)
throws an Exception
Here is an example setting the default values for BoolToObjectConverter
:
XAML
<ContentPage.Resources>
<SolidColorBrush x:Key="TrueColorBrush">Green</SolidColorBrush>
<SolidColorBrush x:Key="FalseColorBrush">Red</SolidColorBrush>
<toolkit:BoolToObjectConverter x:Key="BoolToColorBrushConverter"
TrueObject="{StaticResource TrueColorBrush}"
FalseObject="{StaticResource FalseColorBrush}"
DefaultConvertReturnValue="{StaticResource FalseColorBrush}"
DefaultConvertBackReturnValue="False"/>
</ContentPage.Resources>
C#
var boolToColorBrushConverter = new BoolToObjectConverter
{
TrueObject = new SolidColorBrush(Colors.Green),
FalseObject = new SolidColorBrush(Colors.Red),
DefaultConvertReturnValue = new SolidColorBrush(Colors.Red),
DefaultConvertBackReturnValue = false
};
When set to true
, if an Animation
implementing CommunityToolkit.Maui.Behaviors.AnimationBehavior
throws an Exception
, the Exception
will be caught and will be logged via Debug.WriteLine()
.
Default value is false
.
This option is enabled when calling .UseMauiCommunityToolkit()
:
var builder = MauiApp.CreateBuilder();
builder.UseMauiCommunityToolkit(options =>
{
options.SetShouldSuppressExceptionsInAnimations(true);
})
When set to true
, if a Behavior
implementing CommunityToolkit.Maui.Behaviors.BaseBehavior
throws an Exception
, the Exception
will be caught and will be logged via Debug.WriteLine()
.
Default value is false
.
This option is enabled when calling .UseMauiCommunityToolkit()
:
var builder = MauiApp.CreateBuilder();
builder.UseMauiCommunityToolkit(options =>
{
options.SetShouldSuppressExceptionsInBehaviors(true);
})
Feedback zu .NET MAUI Community Toolkit
.NET MAUI Community Toolkit ass en Open-Source-Projet. Wielt e Link, fir Feedback ze ginn:
Evenementer
Mar 17, 9 PM - Mar 21, 10 AM
Maacht mat bei der Meetup-Serie, fir skaléierbar KI-Léisungen op Basis vu realistesche Benotzungsfäll mat aneren Entwéckler an Experten ze bauen.
Elo umellenTraining
Modul
Create a UI in a .NET MAUI app by using XAML - Training
Learn how to design a UI for a .NET MAUI app using XAML.