LetzerWille
LetzerWille

Reputation: 5658

isEnabled binded to other button click

I can't figure out which resource i am missing for this to work, I getting messages ei namespace is not found.

        <Button 
         Name="btnEnter"
        Click="btnEnter_Click"
        Style="{StaticResource SignButtons}"
        FontFamily="Comic"
        FontSize="24"
        FontWeight="DemiBold"
        Grid.Column="3" 
        Height="51.562"
        Width="75"
        Margin="30,23.624,0,0"
        Grid.Row="3"
        Template="{DynamicResource EnterButton}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <ei:ChangePropertyAction 
                    TargetObject="{Binding ElementName=btnMultiplication}" 
                    PropertyName="IsEnabled" Value="False"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>

here are the namespaces

<Window x:Class="Button_Template.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:Button_Template"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="http://schemas.microsoft.com/netfx/2009/xaml/presentation"

    mc:Ignorable="d"

Upvotes: 0

Views: 98

Answers (2)

ivica.moke
ivica.moke

Reputation: 1064

I would suggest you to follow these steps when you are adding something like ChangePropertyAction, CallMethodAction, etc... 1. Go to Blend and open your project, and select control where you want to insert that ChangePropertyAction enter image description here

After you add ChangePropertyAction Blend will automaticly add xmlns extensions. enter image description here

So you won't have to do it manualy. After you save that in blend, just go to VS and reaload your project and continue.

IMPORTANT Interaction will be added on selected control in your Objects and Timeline window.

Upvotes: 1

mm8
mm8

Reputation: 169240

The ChangePropertyAction type is defined in Microsoft.Expression.Interactions.dll. It is not part of the .NET Framework but you can download this assembly using NuGet: https://www.nuget.org/packages/MicrosoftExpressionInteractions/

Or you can download the Blend SDK from here and add a reference to it: https://www.microsoft.com/en-us/download/details.aspx?id=10801.

The XAML namespace mapping should then be:

xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"

Upvotes: 2

Related Questions