2017-04-07 136 views
0

我想不通哪個資源我缺少這個工作,我得到消息ei命名空間沒有找到。isEnabled綁定到其他按鈕點擊

 <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> 

這裏是

<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" 
+0

向我們展示來自XAML根元素的XML名稱空間,應該很容易發現。 –

+0

嘗試添加此xmlns'xmlns:ei =「clr-namespace:Microsoft.Expression.Interactivity.Core; assembly = Microsoft.Expression.Interactions」' –

+0

我添加了命名空間,現在錯誤消息不同 - ChangePropertyAction不存在在「clr-namespace:Microsoft.Expression.Interactivity.C ore; assembly = Microso ft.Expression.Interations」 – LetzerWille

回答

1

我建議你遵循這些步驟,當您添加類似ChangePropertyActionCallMethodAction等.. 1.進入混合並打開要插入ChangePropertyAction enter image description here

在添加ChangePropertyAction Blend會全自動添加的xmlns擴展項目,然後選擇控制。 enter image description here

因此,您不必手動操作。在將它保存在混合中之後,只需轉到VS並實時加載項目並繼續。

重要事項交互將被添加到對象和時間線窗口中的選定控件上。

+0

我遵循你的指示,但是當我將ChangePropertyAction拖到Objects和TimeLine中的myButton時,我得到消息:在Button中創建ChangePropertyAction。我點擊但沒有任何反應。有沒有任何按鍵組合來完成此操作? – LetzerWille

+0

沒什麼特別的。我只是選擇控制,並在行爲>> ChangePropertyAction使用doubleClick,它會自動將其添加到按鈕。 –

2

ChangePropertyAction類型在Microsoft.Expression.Interactions.dll定義的命名空間。它不是.NET Framework的一部分,但您可以使用NuGet下載此程序集:https://www.nuget.org/packages/MicrosoftExpressionInteractions/

或者您可以從此處下載Blend SDK並添加對其的引用:https://www.microsoft.com/en-us/download/details.aspx?id=10801

的XAML命名空間映射應該然後是:

xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
相關問題