A. WPF中利用ListView.View中的GridView怎么显示图片
我觉得会不会是你图片Path问题,还是啥问题,我给你看下我写的Demo
前台:
<Grid x:Name="bootGrid">
<ListView x:Name="listview">
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn x:Name="gvc">
<GridViewColumn.Header>
<TextBlock>图片列Title</TextBlock>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding ImgPath}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
</Grid>
后台:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
listview.ItemsSource = new List<TestDemo>()
{
new TestDemo(){ ImgPath = "\\Images\\shafa.jpg"}
};
}
}
public class TestDemo
{
public string ImgPath { get; set; }
}