570 likes | 732 Views
Pongsakorn Poosankam Microsoft Innovation Center Manager Microsoft (Thailand) Limited i-popoos@microsoft.com. Software Requirements. Windows Phone Developer Tool Silverlight Toolkit for Windows Phone Expression Blend for Windows Phone Windows Phone Emulator.
E N D
Pongsakorn Poosankam Microsoft Innovation Center Manager Microsoft (Thailand) Limited i-popoos@microsoft.com
Software Requirements • Windows Phone Developer Tool • Silverlight Toolkit for Windows Phone • Expression Blend for Windows Phone • Windows Phone Emulator
The top-level container for each Silverlight page User control
Layout and Controls • Grid • Stack Panel • Canvas • Scroll Viewer
Separates elements into an invisible grid of rows and columns Grid
Grid • The Grid separates elements into an invisible grid of rows and columns. Although more than one element can be placed in a single cell (in which case they overlap), it generally makes sense to place just a single element per cell. Of course, that element may itself be another layout container that organizes its own group of contained controls.
Fine-Tuning Rows and Columns • Absolute sizes • You choose the exact size using pixels. This is the least useful strategy because it’s not flexible enough to deal with changing content size, changing container size, or localization. • Automatic sizes • Each row or column is given exactly the amount of space it needs, and no more. This is one of the most useful sizing modes. • Proportional sizes • Space is divided between a group of rows or columns. This is the standard setting for all rows and columns.
Nesting Layout Containers • The Grid is impressive on its own, but most realistic user interfaces combine several layout containers. They may use an arrangement with more than one Grid or mix the Grid with other layout containers like the StackPanel.
Spanning Rows and Columns • You’ve already seen how you place elements in cells using the Row and Column attached properties. You can also use two more attached properties to make an element stretch over several cells: RowSpan and ColumnSpan. These properties take the number of rows or columns that the element should occupy. • Row and column spanning can achieve some interesting effects and is particularly handy when you need to fit elements in a tabular structure that’s broken up by dividers or longer sections of content.
It simply stacks its children in a single row or column Stack panel
Stack Panel • The StackPanel is one of the simplest layout containers. It simply stacks its children in a single row or column. These elements are arranged based on their order.
Layout Properties • HorizontalAlignment • Determines how a child is positioned inside a layout container when there’s extra horizontal space available. You can choose Center, Left, Right, or Stretch. • VerticalAlignment • Determines how a child is positioned inside a layout container when there’s extra vertical space available. You can choose Center, Top, Bottom, or Stretch. • Margin • Adds a bit of breathing room around an element. The Margin property is an instance of the System.Windows.Thickness structure, with separate components for the top, bottom, left, and right edges. • MinWidth and MinHeight • Set the minimum dimensions of an element. If an element is too large for its layout container, it will be cropped to fit. • MaxWidth and MaxHeight • Set the maximum dimensions of an element. If the container has more room available, the element won’t be enlarged beyond these bounds, even if the HorizontalAlignment and VerticalAlignment properties are set to Stretch. • Width and Height • Explicitly set the size of an element. This setting overrides a Stretch value for the HorizontalAlignment or VerticalAlignment properties. However, this size won’t be honored if it’s outside of the bounds set by the MinWidth, MinHeight, MaxWidth, and MaxHeight.
It allows you to place elements using exact coordinates canvas
Canvas • The only layout container you haven’t considered yet is the Canvas. It allows you to place elements using exact coordinates, which is a poor choice for designing rich data-driven forms and standard dialog boxes, but a valuable tool if you need to build something a little different (such as a drawing surface for a diagramming tool).
<Button/> • Tap or Click Input <Button Content=“Click Me!”/> <Button><Grid>..</Grid></Button> • Content can be Text on any control. • Image in Button, Video in Button, Layout
<TextBlock/> • Display text only • Multiline Support • Can wrapping text • No Border, No Background Color.
<TextBox/> • Text Input • Input Scope Support
<PasswordBox/> • Hidden Text • Display Dot
<RadioButton/> • Single choice select <RadioButtonGroupName="fruit" Content="Apple“ /> <RadioButtonGroupName="fruit" Content="Orange" IsChecked="True“/>
<CheckBox/> • Multiple Choice <CheckBox Content="Apple" IsChecked="True"/> <CheckBox Content="Orange" IsChecked="True"/>
<ToggleButton/> • Flag, Maker • Use IsChecked attribute for verify status <ToggleButton Content="Disable"/> Default Checked
<ProgressBar/> • Display task/job progress • Use Value attribute for update progress • Use Minimum & Maximum attribute for set range of progress • Use IsIndeterminateattribute for unknown progress • Can change Background, Foreground collor
<ProgressBar/> <ProgressBar Value="50“/> <ProgressBarValue="50" IsIndeterminate="True“/>
<Slider/> • Slide for select value • Orientation support • Use Minimum & Maximum attribute for set double value input scope <Slider Value="5"/> 10 0
<Popup/> • Show or Hide control in Popup element <Popup x:Name=“myPopup”> <Grid> <TextBlock Text="Content Here!"/> </Grid> </Popup> Code for Open Popup myPopup.IsOpen = True;
<ListBox/> • Useful for display group item • Single & Multiple choice support <ListBoxSelectionMode=“Single|Multiple"> <ListBoxItem Content="Apple"/> <ListBoxItem Content="Orange"/> <ListBoxItem Content="Banana"/> <ListBoxItem Content="Mango"/> </ListBox>
<ListBox/> - DataTemplate • Normally, use with Data template • Like “for” loop <ListBoxItemSource=“…”> <ListBox. ItemTemplate> <DataTemplate> <Button Content=“{Binding..}”/> <TextBox Text=“{Binding ..}”/> </DataTemplate> </ListBoxItem.ItemTemplate> </ListBox> Duplicate Pattern
Any control • Silverlight Toolkit for Windows Phone http://silverlight.codeplex.com
Multimedia • Type of Multimedia • Audio • Video • HTML and Image • Maps
Audio and Video • Multiply Formats • Delivery Options • Integration with your application
WP7 Multiply Audio Formats. • MP3 – MPEG-1 Audio Layer 3 • WMA – Windows Media Audio • AAC – Advanced Audio Coding • WAV – Wave from Audio Format
WP7 Multiply Video Format • WMV VC-1 - Windows Media Video • MPEG-4 - Moving Picture Experts Group • H.263 – MPEG-4 Part 10/AVC
Silverlight Media Capabilities • Optimized to support video • Power high profile online video experience • High Definition Video • 5.1 Surround Audio
How to play smooth streaming. • Download smooth streaming player • Add reference • Download http://smf.codeplex.com/ <Core:SMFPlayer> <Core:SMFPlayer.Playlist> <Media:PlaylistItemDeliveryMethod="AdaptiveStreaming" MediaSource="http://video3.smoothhd.com.edgesuite.net/ondemand/Big%20Buck%20Bunny%20Adaptive.ism/Manifest"/> </Core:SMFPlayer.Playlist> </Core:SMFPlayer>
WP7 Two methods of integration media • Media Player Launcher • Media Element Control
Media Player Launcher • Simplest • Opens media in WP7 Media Player • Support audio and video stored locally and remotly MediaPlayerLauncher player = new MediaPlayerLauncher(); player.Location = MediaLocationType.Install; player.Media = new Uri(“bear.wmv”, UriKind.Relative); player.Show();
Media Element Control • More complex • More control • Embed media in application • Support audio and video locally and remotely
WP7 Working with HTML • Web Browser Control • Network or local content WebBrowser.Navigate(Uri); • Programmatically created HTML WebBrowser.NavigateToString(html);
WP7Working with HTML • Example of programmatically creating HTML webBrowser.NavigateToString("<b>Inject HTML</b><p/>Create html programmatically");
Double, Color, Point Animate Animation
Session Topics • Storyboards • Animations • Keyframes
Where Do Storyboards Come From? <Storyboard x:Name="Storyboard1"/>
Where Do Storyboards Come From? • Are containers • Can contain many animations • Can also be created in code