JOHN JOHNNNY

JOHN JOHNNNY

  • NA
  • 190
  • 134.8k

Textblock content truncated/not showing completely

Jan 18 2016 4:34 AM
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">

<ScrollViewer Padding="10" Height="Auto" VerticalScrollBarVisibility="Auto">
<TextBlock x:Name="textblock" TextWrapping="Wrap" Foreground="Black" Height="Auto" FontSize="40" />
</ScrollViewer>

</Grid>


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

Answers (4)