17 JULY 2019

c#basics WrapPanel Grid Media click-event ScrollViewer ComboBox

tree

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:

 

14 JULY 2019

c#basics StackPanel DockPanel Binding

fonter

We learned about two types of panels in WPF: StackPanel  and DockPanel. The StackPanel will position each of its child controls next to the other, horizontally (default) or vertically, until there is no more room and then it simply expands itself, if possible. the child controls are stretched to take up the full width or height (based on the largest item). Use the StackPanel when you want a list of controls that takes up all the available room, without wrapping. The DockPanel allows you to dock the child controls to the top, bottom, left or right. By default, the last control, if not given a specific dock position, will fill the remaining space. Use the DockPanel whenever you need to dock one or several controls to one of the side. We explored a font-viewer application which allows the user to select a specific font from a list and modify the text accordingly. the text could be modified by the user and is automatically duplicated among all other text blocks. the entire application is written without a single line of code! only in XAML declarations! we saw how the { } brackets are used to compute a value in XAML – for example to read a list of fonts, set a font value , set a text value etc. we also saw some more cool design features such as : margin, padding, border, background colors and more

More topics covered:

  • What is XML ?
  • Create multiple XAML windows inside the application
  • Binding data to Control
  • Margin orientation – single value, two values, etc.
  • Border control
  • Nesting panels – panel inside a panel
  • ListBox ItemsSource, SelectedItem
  • Path attribute
  • x: [name-of-property]
  • Adding ToolTip 
  • TextBlock is more lightweight control for displaying text
  • TextBox is used when you require user input or edit existing text
  • TextWrapping attribute
  • MinLines attribute

Links:

panels2

10 JULY 2019

c#basics WPF-introduction XAML

wpf.PNG

WPF introduction

More topics covered:

Links:

Design a site like this with WordPress.com
Get started