Visual way to add DATATRIGGER in Expression Blend 2013

What is the correct procedure for attaching a datatrigger to a user interface element using a blend 2013 expression?

If I write a datatrigger directly in xaml, it works well, but I want to know if there is a “visual way” for this.

For example, when creating a listboxitem style, I am doing something like this:


<DataTemplate x:Key="BoundingBoxTemplate" DataType="{x:Type is:BoundingBoxViewModel}" >
    <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding IsBorderVisible}" Value="True">
            <Setter TargetName="InsideRectangle" Property="Stroke" Value="Blue" />
        </DataTrigger>
    </DataTemplate.Triggers>
    <Grid>
        <Rectangle x:Name="InsideRectangle" 
                   Width="{Binding Width}" 
                   Height="{Binding Height}" 
                   Fill="Black" 
                   SnapsToDevicePixels="True" />
    </Grid>
</DataTemplate>

Thank. Lorenzo

+3
source share
1 answer

Here is an example of how you do this using the graphical interface.

Consider this window:

The goal in my example is to make Strokeblue Rectanglewhen the property changes Checkbox.IsCheckedto True.

a ChangePropertyAction Assets > Behaviors.

//. :

, , Trigger Properties.

TriggerType DataTrigger, Binding Checkbox.IsChecked Trigger - True.

Value, , Trigger.

Target Rectangle, Stroke PropertyName Value, , Trigger .

, , CheckBox:

enter image description here

+5

All Articles