2015-01-07 77 views
1

我想在Listview中分組我的項目。我想通過「EventId」屬性對它們進行分組,並將EventId顯示爲標題文本。分組工作是完美的,我的項目是分組的,但問題是,標題文本對於所有組都是空的。ListView組標題無法解析綁定屬性

這是我的XAML:

<ListView 
    ItemsSource="{Binding CardEvents}" 
    MinHeight="120" 
    MaxHeight="120"     
    ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
    ScrollViewer.VerticalScrollBarVisibility="Auto" 
    Name="CardEventsListView"> 
    <ListView.View> 
     <GridView> 
      <GridViewColumn Header="Kart Türü" DisplayMemberBinding="{Binding CardType}" Width="{Binding ActualWidth, ElementName=cardEvent_headerA}"/> 
      <GridViewColumn Header="Oluşturma Tarihi" DisplayMemberBinding="{Binding EventDateTime, Converter={StaticResource dateTimeConverter}}" Width="{Binding ActualWidth, ElementName=cardEvent_headerB}"/> 
      <GridViewColumn Header="Event Id" DisplayMemberBinding="{Binding EventId}" Width="{Binding ActualWidth, ElementName=cardEvent_headerC}"/> 
      <GridViewColumn Header="Dakika" DisplayMemberBinding="{Binding Minute}" Width="{Binding ActualWidth, ElementName=cardEvent_headerD}"/> 
      <GridViewColumn Header="İşlem Dk" DisplayMemberBinding="{Binding RelativeMinute, Converter={StaticResource ResourceKey=timeSpanConverter}}" Width="{Binding ActualWidth, ElementName=cardEvent_headerE}"/> 
      <GridViewColumn Header="Op." DisplayMemberBinding="{Binding UserName}" Width="{Binding ActualWidth, ElementName=cardEvent_headerF}"/> 
     </GridView> 
    </ListView.View> 
    <ListView.GroupStyle> 
     <GroupStyle> 
      <GroupStyle.HeaderTemplate> 
       <DataTemplate> 
        <TextBlock FontSize="14" FontWeight="Bold" Text="{Binding EventId}" /> 
       </DataTemplate> 
      </GroupStyle.HeaderTemplate> 
     </GroupStyle> 
    </ListView.GroupStyle> 

在我的文字塊,在那裏我做了結合我得到警告

無法解析符號 '事件ID'

我不知道爲什麼我無法訪問EventId屬性,而我可以在Gr中訪問它idViewColumn。

回答