WPF修改ListView单独⼀列来显⽰图⽚
<ListView x:Name="lbDetail" BorderThickness="0,0,0,0" Foreground="#FFFCFCFC" Background="Transparent" Height="300" ItemsSource="{Binding Fake Source}" Width="710" Canvas.Left="10" Canvas.Top="90">
<ListView.View>
<!--设置列标签并将列成员与⼀个变量名称相绑定,以便后台链接修改-->
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="FontSize" Value="10"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Silver"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Header="司机" Width="50" DisplayMemberBinding="{Binding driver}"/>
<GridViewColumn Header="车牌号" Width="60" DisplayMemberBinding="{Binding vehicleNo}"/>
<GridViewColumn Header="操作类型" Width="70" DisplayMemberBinding="{Binding action}"/>
<GridViewColumn Header="单据号" Width="110" DisplayMemberBinding="{Binding dispatchNo}"/>
<GridViewColumn Header="操作时间" Width="125" DisplayMemberBinding="{Binding createTime}"/>
<GridViewColumn>
<GridViewColumn.Header>
<TextBlock Width="120" TextAlignment="Center">抓拍图⽚</TextBlock>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
gridview不显示<Image Source="{Binding path}" Width="120" Stretch="Fill"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Height" Value="40"/>
<Setter Property="FontFamily" Value="宋体"/>
<Setter Property="Foreground" Value="#ffffff"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Gray"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Height" Value="100"/>
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
</ListView>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论