• 章节:26
  • 访问:853
  • 时长:00:13:45
  • 日期:2019-12-29 09:58

在用户详情字段增加下面的属性bitmapImageHead

public string headimgurl { set; get; }
        public BitmapImage bitmapImageHead
        {
            get
            {
                return new BitmapImage(new Uri(this.headimgurl));
            }
        }

然后在datagrid里面

<DataGridTextColumn Binding="{Binding headimgurl}" Visibility="Hidden" Header="头像">
                    
                </DataGridTextColumn>
                <DataGridTemplateColumn>
                    <DataGridTemplateColumn.Header>
                        <Label>头像</Label>
                    </DataGridTemplateColumn.Header>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding bitmapImageHead}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

clipboard.png