Click here to Skip to main content
15,878,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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).

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.

XML
<appSettings>
  <add key="aspnet:MaxJsonDeserializerMembers" value="150000" />
</appSettings>
 
Share this answer
 
Comments
Member 10627743 18-Jan-16 7:14am    
I am developing for windows phone 8 i cant locate the web config
How about using a tooltip if the content exceeds the width of the textblock.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900