Showing posts with label WPF. Show all posts
Showing posts with label WPF. Show all posts

Thursday, 27 October 2011

WPF Study Key words

Study strategy: Do Practice exams, then read the self-paced training book on weaknesses.

[Controls]
WPF Controls:
+ individual controls
+ Item controls
+ Layout controls

Attached Properties
e.g.

[Resource]
Binary resource
Logical resource - can be defined and accessed in XAML files in comparison to Binary resources
Static resource
Dynamic resource

pack URI syntax: pack:////
e.g. Source="pack://application:,,,/myFolder/myPic.bmp"
Use the pack URI syntax to access resources embedded in other assemblies
pack://application:,,,/;component//

siteOfOrigin pack URI syntax:
This is useful for ClickOnce application.

[ClickOnce Application]
ClickOnce application:
Pros: Easy to deploy - just need to click on a link.
Update automatically
Run in a security sandbox.
Cons: Cannot change registry
Cannot manage COM
Cannot manage ODBC
Cannot do other stuff with high security restriction.

Tuesday, 20 September 2011

What is WPF DependencyProperty?

When you register a DependencyProperty you provide a callback to be called when the value changes.

Here (http://wpftutorial.net/DependencyProperties.html) you have more details. I don't think anything else is public about the internals of WPF. I might be wrong.

Friday, 16 September 2011

WPF markup extensions


is called a markup or markup tag
{StaticResource ...} is called a markup extension

Markup extension enables the XAML parser to translate value to primitives or objects. There two major categories of extensions: XAML-Defined Markup Extensions and WPF-Specific Markup Extensions

XAML-Defined Markup Extensions
x:Type
x:Static
x:Null
x:Array

WPF-Specific Markup Extensions (Listed 3 most important extensions below)
StaticResource
DynamicResource
binding

http://msdn.microsoft.com/en-us/library/ms747254.aspx

Tuesday, 23 August 2011

Model View ViewModel in WPF

Binding is an important concept in WPF implementation of the Model View ViewModel.

Step 1: Bind the UI component with data model in XAML.

Step 2: Implement the INotifyPrepertyChanged interface in the ViewModel

Reference:
http://msdn.microsoft.com/en-us/library/system.windows.data.binding.mode.aspx
http://msdn.microsoft.com/en-us/library/ms743695.aspx

This is how the View associated with the ViewModel

This is how the ViewModel associated with the Model.
The Code is in the parent ViewModel.







Thursday, 28 July 2011

What does the WPF star do (Width=“100*”)

Another example, to give 30% to column 1 and 70% to column 2 -



And likewise for rows -



I am sure everyone else knows this, but I didn't until recently: the numbers do not have to be integers (following Dave's example) -

WPF Basics - Layout Panels

In order to arrange controls, you need to use a layout panel. WPF ships with the following layout panels:
Canvas - for specific (X,Y) positioning
StackPanel - for stacking elements horizontally or vertically
WrapPanel - automatically handles wrapping elements to a new row as needed
DockPanel - for familiar docking functionality. Dock to the sides of the window.
Grid - for a row and column based layout
UniformGrid - a specialized form of Grid where all cells are the same size