本文介绍了文本块内容被截断/未完全显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨我的文本块内容有问题,内容没有完全显示。 每当我向上滚动时总是被截断。我试过增加textblock / scrollviewer hieght仍然是一样的 见下面的代码 xaml <! - ContentPanel - 在此处添加其他内容 - > < grid x:name =ContentPanelgrid.row =1margin =12,0,12,0 xmlns:x =#unknown> < scrollviewer padding =10height =Autoverticalscrollbarvisibility =Auto> < textblock x:name =textblocktextwrapping =Wrapforeground =Blackheight =Autofontsize =40> xaml.cs 名称空间DevotionJson { 公共部分类BibleInYear:PhoneApplicationPage { private List< bibledata>奉献; 公开BibleInYear() { InitializeComponent(); devotions = new List< bibledata>(); AddDevotions(); } protected override void OnNavigatedTo(NavigationEventArgs e) { DateTime dt = DateTime.Now; int month = dt .Month; int year = dt.Year; int index; if(DateTime.IsLeapYear (年)||(月< = 2)) { index = dt.DayOfYear - 1; //列表索引从0 } else { index = dt.DayOfYear; //添加一天 } textblock.Text = devotions [index] .ToString(); //或其他一些财产 } private void AddDevotions() { for(int i = 1; i< = 366; i ++) { string filePath =BibleInYear / Bible+ i.ToString()+ .json; BibleData d = ReadJsonFile(filePath); devotions.Add(d); } } 公共BibleData ReadJsonFile(字符串JsonfilePath) { BibleData [] d = null ; 使用(StreamReader r = new StreamReader(JsonfilePath)) { string json = r。 ReadToEnd(); d = JsonConvert.DeserializeObject< bibledata []>(json); } 返回d [0]; } } } 请帮助HiI am having issues with my textblock content, the content does not show completely.Whenever i scroll up is always truncated. i have tried increasing the textblock/scrollviewer hieght is still the samesee the code belowxaml<!--ContentPanel - place additional content here--><grid x:name="ContentPanel" grid.row="1" margin="12,0,12,0" xmlns:x="#unknown"><scrollviewer padding="10" height="Auto" verticalscrollbarvisibility="Auto"><textblock x:name="textblock" textwrapping="Wrap" foreground="Black" height="Auto" fontsize="40">xaml.csnamespace DevotionJson{public partial class BibleInYear : PhoneApplicationPage{private List<bibledata> devotions;public BibleInYear(){InitializeComponent();devotions = new List<bibledata>();AddDevotions();}protected override void OnNavigatedTo(NavigationEventArgs e){DateTime dt = DateTime.Now;int month = dt.Month;int year = dt.Year;int index;if (DateTime.IsLeapYear(year) || (month <= 2)){index = dt.DayOfYear - 1; // list is indexed from 0}else{index = dt.DayOfYear; // add a day}textblock.Text = devotions[index].ToString(); // or some other property}private void AddDevotions(){for (int i = 1; i <= 366; i++){string filePath = "BibleInYear/Bible" + i.ToString() + ".json";BibleData d = ReadJsonFile(filePath);devotions.Add(d);}}public BibleData ReadJsonFile(string JsonfilePath){BibleData[] d = null;using (StreamReader r = new StreamReader(JsonfilePath)){string json = r.ReadToEnd();d = JsonConvert.DeserializeObject<bibledata[]>(json);}return d[0];}}}Kindly help推荐答案如果数据很大,JSON反序列化会引起问题。尝试在Web配置中设置最大长度,如下所示。希望这可以解决问题。If data is huge, JSON deserialize would cause issue. Try setting max length as shown below in web config. Hope this may resolve the issue.<appSettings> <add key="aspnet:MaxJsonDeserializerMembers" value="150000" /></appSettings>如何使用工具提示如果内容超出文本块的宽度。How about using a tooltip if the content exceeds the width of the textblock. 这篇关于文本块内容被截断/未完全显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
06-11 02:54