Share via


PropertyCondition Class

Definition

A condition that is satisfied when a property has a specified value.

public ref class PropertyCondition sealed : Microsoft::Maui::Controls::Condition
public ref class PropertyCondition sealed : Microsoft::Maui::Controls::Condition, Microsoft::Maui::Controls::Xaml::IValueProvider
public sealed class PropertyCondition : Microsoft.Maui.Controls.Condition
[Microsoft.Maui.Controls.Xaml.AcceptEmptyServiceProvider]
public sealed class PropertyCondition : Microsoft.Maui.Controls.Condition, Microsoft.Maui.Controls.Xaml.IValueProvider
type PropertyCondition = class
    inherit Condition
[<Microsoft.Maui.Controls.Xaml.AcceptEmptyServiceProvider>]
type PropertyCondition = class
    inherit Condition
    interface IValueProvider
Public NotInheritable Class PropertyCondition
Inherits Condition
Public NotInheritable Class PropertyCondition
Inherits Condition
Implements IValueProvider
Inheritance
PropertyCondition
Attributes
Implements

Remarks

The PropertyCondition class is suitable for checking property values on the control that contains the MultiTrigger that contains it. To check values on other controls, developers can use the BindingCondition class, in addition to any property conditions in the trigger list.

The XML example below creates a property condition within a surrounding MultiTrigger within a TextCell that turns the text green when the secret is typed. The code is turned back to the default color if the user then edits the secret. (Typically, a MultiTrigger would have more than one condition; this example is simplified for clarity.)

<Entry Placeholder="Type the secret!"
       VerticalOptions="Center"
       HorizontalOptions="Center">
<Entry.Triggers>
<MultiTrigger TargetType="Entry" >
<MultiTrigger.Conditions>
<PropertyCondition Property="Text"
                                     Value="The text color is green" />
</MultiTrigger.Conditions>
<Setter Property="TextColor"
                  Value="Color.Green" />
</MultiTrigger>
</Entry.Triggers>
</Entry>

Constructors

Name Description
PropertyCondition()

Initializes a new instance of the PropertyCondition class.

Properties

Name Description
Property

Gets or sets the bindable property whose value is evaluated for this condition.

Value

Gets or sets the value that satisfies this condition when matched by the property.

Explicit Interface Implementations

Name Description
IValueProvider.ProvideValue(IServiceProvider)

Applies to

See also