I have a large amount of content, about the size of a small book, over 10k words, I was thinking to make a book reader-like style, but Windows Phone SDK doesn't have such a control.
How can I handle this data?
I have a large amount of content, about the size of a small book, over 10k words, I was thinking to make a book reader-like style, but Windows Phone SDK doesn't have such a control.
How can I handle this data?
Is the material divided into sections or chapters? If so, how about this:
LongListSelector to hold chapters; this is your table of contents. Selecting chapter opens a new page.
Break the section materials into various "pages" of enough content to fill the phone screen. Dynamically create PivotItems to hold each of these pages. That way the user swipes side to side to change pages.
Provide appbar buttons to go forward and back a chapter, and a link to the table of contents.
Is that what you had in mind?
EDIT: Giving some sample code for dynamic pivot items.
You'll need to add a foreach loop, if statement, or other item to determine when/how many PivotItems to make. Also, include an if statement to skip this code if you've already loaded the page or you'll end up with duplicate PivotItems. I typically do this in the overriden OnNavigatedTo method.
PivotItem pivotItem = new PivotItem()
{
Header = "Header"
// Add the rest of your PivotItem specific values here
};
// You'll need to add the grid item, and contents, that will reside in the PivotItem
Grid grid = new Grid();
grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
grid.RowDefinitions.Add(new RowDefinition());
TextBlock textBlock = new TextBlock();
textBlock.Text = "Text";
/* Don't apply styling in code behind. It won't work. Make the style item in XAML and set it via Control.Style for the given item */
textBlock.Style = PivotItemTitleStyle;
// Make sure you add the various items to the grid
grid.Children.Add(textBlock);
// Add the grid to the PivotItem
pivotItem.Content = grid;
/* And the PivotItem to the Pivot control. Do this for each PivotItem you need via a foreach loop, etc. */
MainPivot.Items.Add(pivotItem);
EDIT: One important thing to remember: You can't Collapse PivotItems. Their contents can be collapsed, but the item will still be present in the app (the user will swipe to a blank object). If you need to hide the item, you'll need to actually remove it from the Pivot control.