【问题标题】:MVVM Light Hub Control SectionsInViewChanged RelayCommandMVVM 灯集线器控制 SectionsInViewChanged RelayCommand
【发布时间】:2014-11-04 09:37:49
【问题描述】:

是否可以将 MVVM Light、Relay 命令绑定到集线器控件中的 SectionsInViewChanged 事件?

【问题讨论】:

    标签: events mvvm-light win-universal-app


    【解决方案1】:

    没用过新的Hub控件,不过应该和其他的一样吧。您可以使用 EventToCommand 将 RelayCommands 绑定到事件。阅读http://msdn.microsoft.com/en-us/magazine/dn237302.aspx

    显示此用户控件绑定触发 LoadedCommand 的 Loaded 事件的片段:

    <UserControl x:Class="Bill.Views.Setup.AdjustmentReasonsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF45"
             xmlns:igDP="http://infragistics.com/DataPresenter"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             >
    
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <cmd:EventToCommand Command="{Binding Mode=OneWay, Path=LoadedCommand}" PassEventArgsToCommand="True" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    

    。 . .

    【讨论】:

      猜你喜欢
      • 2015-06-27
      • 2017-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多