public void TextBlockChange(TextBlock t, SearchBookResult searchBookResult) { /* "index": "H33-44/12", "all": "2", "name": "德福考试高分突破真题集", "author": "(德) 德福考试院编", "publish": "外语教学与研究出版社2011", "type": "中文图书", "left": "1" */ t.Text += "书名: " + searchBookResult.name + "\n"; t.Text += "索引号: " + searchBookResult.index + "\n"; t.Text += "作者: " + searchBookResult.author + "\n"; t.Text += "类型: " + searchBookResult.type + "\n"; t.Text += "出版社: " + searchBookResult.publish + "\n"; t.Text += "可借/总共: " + searchBookResult.left + "/" + searchBookResult.all + "\n"; }
public TextBlock TextBlockCreate(SearchBookResult searchBookResult) { TextBlock t = new TextBlock(); TextBlockChange(t, searchBookResult); t.Margin = new Thickness(20, 0, 0, 0); t.FontSize = 20; t.TextWrapping = TextWrapping.WrapWholeWords; return t; }