开发者

Adding an Image to ListView in WPF like this ...?

I'm gonna create a ListView in WPF like the below image

Adding an Image to ListView in WPF like this ...?

(source: picfront.org)

http://www.picfront.org/d/7xuv

I mean I wanna add an image beside of Gravatar label within Name column.

Would it be OK if you guided me ?

Edit: The image is o开发者_StackOverflow中文版utput of a method. The method makes the image from a base-64 string.


As long as you're already familiar with how to data bind a ListView then it's pretty simple really. In your cell template you would just need a StackPanel with an Image and a TextBlock side by side.

<ListView>
  <ListView.View>
    <GridView>
      <GridViewColumn>
        <GridViewColumn.CellTemplate>
          <DataTemplate>
            <StackPanel Orientation="Horizontal">
              <Image Width="16" Height="16" Source="{Binding IconUri}"/>
              <TextBlock Text="{Binding Name}"/>
            </StackPanel>
          </DataTemplate>
        </GridViewColumn.CellTemplate>
      </GridViewColumn>
      <GridViewColumn ... />
      <GridViewColumn ... />
    </GridView>
  </ListView.View>
</ListView>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜