
We learned about two new types of panels in WPF: WrapPanel and Gird. The WrapPanel will position each of its child controls next to the other, horizontally (default) or vertically, until there is no more room, where it will wrap to the next line and then continue. Use it when you want a vertical or horizontal list controls that automatically wraps when there’s no more room. The Grid can contain multiple rows and columns. You define a height for each of the rows and a width for each of the columns, in either an absolute amount of pixels, in a percentage of the available space or as auto, where the row or column will automatically adjust its size depending on the content. Use the Grid when you need multiple columns and often in combination with the other panels. We investigated more WPF controls: ScrollViewer, ComboBox and Media (image, video). we created a button click Event in the XAML code and attached it to a function. we saw that WPF controls have a property window (when pressing F4) which displays their properties and events. modifying properties in the property window will modify the XAML (and vice versa). we studied how to Bind data to a ComboBox control. in order to do so we created a List<Person> and assigned the ItemsSource of the ComboBox to this list (in the C# code behind). in the XAML, we added a ComboBox control which contain a TextBlock with Binding data to the Person.FirstName and a TextBlock with Binding data to the Person.LastName, that’s it!
More topics covered:
- Grid: ColumnDefinition RowDefinition
- ColumnSpan
- WPF namespace, xmlns:x
- MouseDown Event
- DataTemplate
- { Binding Property-Name }
- Adding media to WPF window
- Adding media to solution explorer
- Modifying media build action
- Project Resource
- Embedded Resource
Links:
- Class code: Home work solution
- Class code: Grid panel basic
- Class code: Combo box
- Class code: Adding media
- Class code: ScrollViewer
- WPF namespace – MSDN link
- WPF Grid panel – nice article
- WPF ScrollViewer – tutorials point
- DataTemplate – nice article
- Home Work!
- Lesson Summary Video!


