Thursday, July 24, 2014

Prism Interactivity / Notification

http://msdn.microsoft.com/en-us/library/ff921081%28v=pandp.40%29.aspx

MVVM




http://msdn.microsoft.com/en-us/library/gg405484%28v=pandp.40%29.aspx

DependencyProperties


  • Change notification
    Dependency properties have a built-in change notification mechanism. By registering a callback in the property metadata you get notified, when the value of the property has been changed. This is also used by the databinding. 
  •  Value inheritance
    When you access a dependency property the value is resolved by using a value resolution strategy. If no local value is set, the dependency property navigates up the logical tree until it finds a value. When you set the FontSize on the root element it applies to all textblocks below except you override the value.
  • Reduced memory footprint
    It's a huge dissipation to store a field for each property when you think that over 90% of the properties of a UI control typically stay at its initial values. Dependency properties solve these problems by only store modified properties in the instance. The default values are stored once within the dependency property.
     





Here is a very good article for DependancyProperty.

http://wpftutorial.net/DependencyProperties.html

http://wpftutorial.net/DependencyProperties.html

DependencyProperty.Register

DependencyProperty.RegisterReadOnly

DependencyProperty.RegisterAttched

Wednesday, July 23, 2014

WPF ItemTemplate, DataTemplate exmaple

Very nice article about ItemTemplate and DataTemplete. Here is the link.

http://www.wpf-tutorial.com/list-controls/combobox-control/

WPF Visual Tree VS Logical Tree



Basically, logical tree elements are the ones we see on the UI and all other controls behind the scene that gets created in order to render them are includes in visual tree.

The Logical Tree

The logical tree describes the relations between elements of the user interface. The logical tree is responsible for:
  • Inherit DependencyProperty values
  • Resolving DynamicResources references
  • Looking up element names for bindings
  • Forwaring RoutedEvents

The Visual Tree

The visual tree contains all logical elements including all visual elements of the template of each element. The visual tree is responsible for:
  • Rendering visual elements
  • Propagate element opacity
  • Propagate Layout- and RenderTransforms
  • Propagate the IsEnabled property.
  • Do Hit-Testing
  • RelativeSource (FindAncestor)

Full article can be read from wpf helper site here 

http://wpftutorial.net/LogicalAndVisualTree.html


There are VisualTreeHelper and LogicalTreeHelper class as part of .NET frameworks.

We can find them here

http://msdn.microsoft.com/en-us/library/system.windows.logicaltreehelper%28v=vs.110%29.aspx

http://msdn.microsoft.com/en-us/library/system.windows.media.visualtreehelper%28v=vs.110%29.aspx





WPF Class Hierarchy