本文介绍了如何使用MVVM模式在Silverlight 3.0中命令属性绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是Silverlight 3.0的新手,我想使用Silverlight 3.0中的MVVM模式来命令属性绑定.

我在Google中找到了一些解决方案,如下所示
1.
一个.在xaml中添加-xmlns:i ="clr-namespace:System.Windows.Interactivity; assembly = System.Windows.Interactivity"
b.

Hi All,

I am new in silverlight 3.0 ,I want to Command Property bind using MVVM Pattern in Silverlight 3.0.

I have found some solution in google as below
1.
a. add in xaml - xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
b.

<Button x:Name="Submit" Content="Submit"    ClickMode="Press" Grid.Row="4" >
           <i:Interaction.Triggers>
               <i:EventTrigger EventName="Click">
                   <i:InvokeCommandAction Command=""

                               CommandParameter="{Binding Click, ElementName=Submit}"/>
               </i:EventTrigger>
           </i:Interaction.Triggers>
           <!--</i:KeyTriggerFiredOn>
               <i:EventTrigger EventName="Click">
                   <ei:CallMethodAction   TargetObject="{Binding}" MethodName="ShowCustomer"/>
               </i:EventTrigger>
           </i:Interaction.Triggers>-->
       </Button>



2 .

<按钮x:Name ="Submit" Content ="Submit" ClickMode ="Press" Command ="Submit" Grid.Row ="4"></Button>

上面的代码也不起作用.但是Command属性不在Silverlight 3.0中


您能否建议我,以便我可以在Silverlight 3.0中轻松绑定Command属性?



2.

<Button x:Name="Submit" Content="Submit" ClickMode="Press" Command="Submit" Grid.Row="4" ></Button>

Above code is also not working. However Command Property is not in Silverlight 3.0


Can you please suggest me so that i can bind Command Property easily in Silverlight 3.0

推荐答案


这篇关于如何使用MVVM模式在Silverlight 3.0中命令属性绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 22:09