如何MouseOver从动态集中获取事件ListViewItems?
XAML:
<ListView Name="ListView" x:FieldModifier="public" ItemsSource="{Binding FileDataList}" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="8" Grid.RowSpan="12">
<ListView.View>
<GridView>
<GridViewColumn Header="Filename" DisplayMemberBinding="{Binding Name}" Width="Auto"/>
<GridViewColumn Header="Change date" DisplayMemberBinding="{Binding Date}" Width="Auto"/>
<GridViewColumn Header="Type" DisplayMemberBinding="{Binding Type}" Width="Auto"/>
<GridViewColumn Header="Size" DisplayMemberBinding="{Binding Size}" Width="Auto"/>
</GridView>
</ListView.View>
</ListView>
后面的代码:
fileDataList.Add(new FileData() { Name = System.IO.Path.GetFileNameWithoutExtension(filename), Date = File.GetLastWriteTime(filename), Type = System.IO.Path.GetExtension(filename), Size = GetFileSize(filename) });
这是列表:
public List<string> files = new List<string>();
private ObservableCollection<FileData> fileDataList = new ObservableCollection<FileData>();
明月笑刀无情
相关分类