Click here to Skip to main content
14,118,792 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi I 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 same

see the code below
xaml
<!--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.cs
namespace 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
Posted
Updated 17-Jan-16 22:41pm
v2
Comments
Sinisa Hajnal 18-Jan-16 5:56am
   
Is there maxlength set? Also, check that deserialize returns full text. If you have database content, check that the field is big enough to hold the text (so that it isn't truncated on save) etc...go through all places where you manipulate text and check size of corresponding field(s).
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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>
   
Comments
Member 10627743 18-Jan-16 7:14am
   
I am developing for windows phone 8 i cant locate the web config
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

How about using a tooltip if the content exceeds the width of the textblock.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190518.1 | Last Updated 22 Jan 2016
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100