2017-02-06 6 views
1

を更新し、コレクションにトグルされます。トグルボタンは、私はこのようなジョブを示すデータグリッドを持って

最初の行をリフレッシュすると自動的に切り替わります。

私はこれが私のxamlである理由...

を把握することはできません。

<DataGrid Grid.Row="1" 
      ItemsSource="{Binding Path=JobCollectionView}" 
      SelectedItem="{Binding Path=SelectedEntry, 
           UpdateSourceTrigger=PropertyChanged, 
           Mode=TwoWay}" 
      IsReadOnly="True"      
      x:Name="dataGrid" 
      AutoGenerateColumns="False" 
      CanUserAddRows="False"    
      SelectionUnit="FullRow" 
      SelectionMode="Single" 
      ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
      CanUserResizeColumns="True"      
      VerticalContentAlignment="Center"> 
[...]> 
<DataGridTemplateColumn CellStyle="{StaticResource DataGridNonFocusableCell}"> 
    <DataGridTemplateColumn.CellTemplate> 
    <DataTemplate> 
     <ToggleButton IsChecked="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, 
             Path=DetailsVisibility, 
             Converter={StaticResource BoolToVisConverter}, 
             Mode=TwoWay, 
             FallbackValue=False}" 
        Height="20" 
        Width="20" /> 
    </DataTemplate> 
    </DataGridTemplateColumn.CellTemplate> 
</DataGridTemplateColumn> 
[...]/> 

答えて

1

結合RelativeSourceが行のセルテンプレートのために必要とされると、それは常に行を取得することができ、なぜそれは不明です1実際の行に関係なく、すべてのデータが必要です。(?)

行のdatacontextは、必要な項目への実際の参照を保持する必要があります。

バインドを削除して、オブジェクトの継承されたdatacontextバインドに直接的に影響します。

これでうまくいかない場合は、状況を再現できるデモンストレーション可能な例(ここでは代わりに投稿できる)に状況を分割してください。デモを作成すると、失敗した理由を並べ替えることができます。

関連する問題