2011-04-07 1 views
0

제대로 작동하지 않는 것 같습니다. 기본적으로, 나는 목록에 바인딩 된 ObservableCollection 있습니다. 이 콜렉션 안에는 명령이 실행될 때 변수로 전달할 때 사용해야하는 객체가 있습니다. 내 계획은 이것을 CommandParameter로 전달하는 것이지만, 작동시키지는 못한다. 개체는 실제로 열거 형 값이지만 정적 텍스트 이외의 다른 값으로는 사용할 수 없습니다. 아래 코드는 Interactivity (wi)와 블렌드의 dll (sl)을 사용하는 MVVM 개념을 사용합니다. 이 속성은 ListItem에 public이며 INotifyPropertyChanged를 구현합니다.Silverlight에서 바인딩 바인딩 명령 매개 변수

감사합니다.

<ListBox ItemsSource="{Binding Path=MyList}" ScrollViewer.VerticalScrollBarVisibility="Disabled"> 
        <wi:Interaction.Triggers> 
         <wi:EventTrigger EventName="SelectionChanged"> 
          <sl:InvokeDataCommand CommandParameter="{Binding MyList.ListItem.Property}" Command="{Binding Source={StaticResource Locator}, Path=MyTestPage.TestExecute}" /> 
         </wi:EventTrigger> 
        </wi:Interaction.Triggers> 

... 

답변

0
 <ListBox x:Name="listBox" ItemsSource="{Binding Path=MyList}" ScrollViewer.VerticalScrollBarVisibility="Disabled"> 
    <wi:Interaction.Triggers>       
    <wi:EventTrigger EventName="SelectionChanged"> 
    <sl:InvokeDataCommand CommandParameter="{Binding ElementName=listBox, Path=SelectedItem.Property}" Command="{Binding Source={StaticResource Locator}, Path=MyTestPage.TestExecute}" /> 
</wi:EventTrigger> 
</wi:Interaction.Triggers> 

어떻게이 일에 대해? selectedItem에 바인드하고 싶습니까?

MyList가 ObservableCollection입니까?