Viewers: in countries Watching now:
Microsoft Silverlight 5 is a rich application framework for creating high-performance, cross-platform desktop and mobile applications. In this course, author Walt Ritscher demonstrates how to build a variety of applications in Silverlight, with particular focus on building compelling business applications and delivering premium video and audio content. Developers will work with the C# programming language and Visual Studio Professional, as well as Expression Blend, a tool that simplifies creation of the interactive user interfaces expected in modern-day applications.
Silverlight includes a read-only version of the rich TextBox called the RichTextBlock. It works with the same text elements, like bold and span as the RichTextBox. It was added to the framework to enable multicolumn and custom overflow layout. If you want to create a three- column, magazine style layout then the RichTextBlock is your element. It works with another read-only control called the RichTextBlockOverflow. I'm inside Visual Studio for this demo. I've opened a project called TextOverflow.
I'll start by looking at the LongTextPage.xaml file. In my XAML I'm adding a RichTextBox and I'm loading the content from a file. I have a content file in the Docs folder called ExploreCa.sav. I marked it as a resource to my project which means it is packaged in the XAP and I can write code to load it into my application. I'll show you that code now. I go to my LongTextPage.xaml.cs file, and I'll show you that I have this have this page loaded event here.
I start by going to the Application level and getting that resource out of my XAP. It comes back as a stream of bytes. To store that in this variable I will type StreamResourceInfo. Once I have that variable I can get the stream and pass it to a reader class. Then I call the ReadToEnd method which reads all the text in the file and stores it in the xaml property on my LongRichTextBox. Let's see what this looks like when I run the application. Here is my RichTextBox, I'm scrolling up and down in the content.
It looks nice but I'd like it to overflow onto the page so the reader can see more. I do that in this other tab. This first column contains a RichTextBlock and the other two columns contain overflow elements. When I make the browser narrower or wider you can see that the text flows from column to column. Let me show you how I did that. I'm going to open this OverflowPage. This first column, which is part of my Grid, contains a RichTextBlock. And remember that this is a read-only control, and I'm loading my text in a slightly different mechanism than I did the last demo.
Here the way I'm loading the file is different. The elements are hard coded in the XAML. This is due to a limitation on how the TextBlock and work with files. Here you can see a paragraph and another paragraph and so on. The way you accomplish an overflow as you set this OverflowContentTarget. I'm using a data binding here to point to another element on this page. We'll learn more about binding in another chapter. Again, so I'd take this RichTextBlock, we tell it to overflow the content into another element called the firstOverflow, which is down here, that is in my second column.
And the second control which is called the RichTextBlockOverflow, it also has an OverflowContentTarget with a Binding that tells it to overflow into an element called secondOverflow which is right here on line 144. Your imagination is the only limit on how you can use these two read-only controls. You can create a patchwork of overflows or change the width of overflows to flow around images and other UI elements.
Find answers to the most frequently asked questions about Silverlight 5 Essential Training .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.