Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
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.
We've selected a few controls in this chapter. There are more controls available. I certainly don't have time to show all of them in this essentials course. I do want to show you a few more before it close this chapter. For this demonstration, I'll use Visual Studio and a project called MoreControls. I'll start by looking in TimePickerPage. I'm using a control from the Toolkit called TimePicker. You can see it here it allows the user to select the time. It's pretty simple control to work with. I also have a TextBlock which is going to receive the data from the TimePicker. I needed to write a little bit of code.
I'll show you that. I'll press F7. Our vector showed the ValueChanged event on my TimePicker and told it to call this function, timePicker1_ValueChanged. When this code runs, I grab the new time value and assign it to my TextBlock. Press F5 to check it out. Here it is. Here's the TimePicker. I'll come over here and click on the clock, choose my new time 7:30 AM and you can see the time was transferred to the TextBlock. The next control that I want to look at is called the rating control.
You've seen this on websites. The user picks the number of star review they want to give a restaurant or a movie. I'm going to add a ratings control right up here in this top area. I'll choose Toolbox. I'll scroll down to the all Silverlight control section and then choose Rating, and I'll drag that to my user interface. Now without writing any code, this Rating control is ready to use. It's using five stars and an initial value of 0. Let's run the applications and see. You can obviously customize this control by changing the number of stars.
I can also set an initial value. You can also do what's called the Discrete rating, where you set it so that rather then doing each star and building up from the bottom, you only select one. This is an example from the Silverlight control team. I know I can click on these and select one of the five. Obviously, we're also using a custom vector drawing for each of these items. You can find that on the Silverlight Toolkit website. Let me turn back to my XAML. Let's look briefly at this control. Here's how you specify the number of items you want, and here's how you specify the initial value.
Yes, it's a value between 0 and 1. This means 60%. The next control I'd like to look at lives on the Accordion page. It's called the Accordion Control. It is an Items Control where every item has an expander. You'll see more about Items Controls in the Data chapter. What's interesting about the Accordion control is that each item is wrapped in an accordion item. For this example, I start by putting an Accordion control inside my main grid. Then each item that I want to show in my Accordion is wrapped in something called an AccordionItem.
Notice the Header here, Coast House. See how that shows up in the UI up here. This is what the user sees when the Accordion item is collapsed. When the user comes over and clicks on the Accordion button, then it'll expand and show everything that's in this section. So it'll show that StackPanel and the Image and this TextBlock. As you can see, I have 4 AccordionItems. Would you like to see what this looks in runtime? Good, here it is.
Notice how it opened the first accordion item when I open this and now I'll click on this Forest House and the Estate, and I get a nice little animated transition between all the Accordion items. I really like this last feature. It's the ListBoxDragTarget. This is as a wrapper control for list boxes. To see this I need to go to my DragDecoratorPage. On this page, I have three ListBox. Each ListBox is wrapped in the special control, ListBoxDragDropTarget and then I set this property called AllowDrop='True' on each one.
Without writing any code, I can now go into my application, pick an item off this first ListBox and drag it and drop it on the second ListBox. Now if you want to remove the items from the first ListBox, if you want to prevent duplicates from happening in the second ListBox, you need to listen to some events and write some code. But just out of the box, it automatically supports drag-and-drop between ListBoxes. You've seen a handful of useful controls in this chapter. You'll find more controls in the text and data binding chapters.
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.