2012-03-23 5 views
1

MVVM Windows Phone 프로젝트를 다시 방문하고 ListBox에 트리거를 추가 할 때 문제가 발생합니다. 프로젝트를 7.1로 업그레이드했습니다. 다음과 같이ListBox에 대해 트리거를 설정할 때 예외 발생

그러나
  <ListBox x:Name="MainListBox" 
       ItemsSource="{Binding MyItems}" 
       Grid.Row="1" 
       Margin="12" 
       ItemContainerStyle="{StaticResource MyListItemStyle1}" 
       SelectedIndex="{Binding CurrentSelectedIndex, Mode=TwoWay}" 
       ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
       i:Interaction.Triggers="{StaticResource PerformSelectionChangedEventTrigger}" /> 

지금 예외를 받고 오전 : - - 다음과 같이 내가 이전에 코드를했다

설정할 수 없습니다 읽기 전용 속성을 'System.Windows.Interactivity.Interaction.Triggers을

다음 변경하면 문제를 해결하는 것 같다 : - 나는 예외 메시지를 검색 한

  <ListBox x:Name="MainListBox" 
       ItemsSource="{Binding MyListItems}" 
       Grid.Row="1" 
       Margin="12" 
       ItemContainerStyle="{StaticResource MyListItemStyle1}" 
       SelectedIndex="{Binding CurrentSelectedIndex, Mode=TwoWay}" 
       ScrollViewer.HorizontalScrollBarVisibility="Disabled">     
      <i:Interaction.Triggers> 
       <i:EventTrigger EventName="SelectionChanged"> 
        <cmdextras:EventToCommand Command="{Binding Path=PerformSelectionChanged}" 
               PassEventArgsToCommand="True" /> 
       </i:EventTrigger> 
      </i:Interaction.Triggers> 
     </ListBox> 

그러나 나는 확실하지 오전 왜 w를 사용 설정 "인라인"트리거 ork 그리고 더 이상 작동하지 않습니다.

누군가이 문제에 대해 밝힐 수 있습니까?

답변

2

인라인값을으로 설정하면됩니다. 컬렉션을 설정 중입니다.

종종 컬렉션을 읽기 전용으로 만들고 그 비트를 변경하고 다른 방법으로 에 추가하면 컬렉션이 읽기 전용이더라도 문제가되지 않습니다.