github twitter email rss
WPF
0001 Jun 1
3 minutes read

WPF

WPF and Windows Forms Interoperation http://msdn.microsoft.com/en-us/library/ms751797.aspx
Windows Forms Controls and Equivalent WPF Controls http://msdn.microsoft.com/en-us/library/ms750559.aspx

MVVM

http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
http://visualstudiogallery.msdn.microsoft.com/3ab5f02f-0c54-453c-b437-8e8d57eb9942/
http://stackoverflow.com/questions/1405739/mvvm-tutorial-from-start-to-finish

exampels

http://www.jarloo.com/jot/
http://www.firetrust.com/en/products/mailwasher-pro
http://wpf.codeplex.com/releases/view/14962

support

http://social.msdn.microsoft.com/forums/en-US/wpf/threads/
http://msdn.microsoft.com/en-us/library/vstudio/ms754130.aspx

some info

http://paulstovell.com/blog/six-years-of-wpf

libraries

types

binding combobox

Appearance tweaking

Combo style

WinForms in WPF

dependency properties http://msdn.microsoft.com/en-us/library/ms752914.aspx
data binding http://msdn.microsoft.com/en-us/library/ms752347.aspx
resources http://msdn.microsoft.com/en-us/library/ms750613.aspx
data templates http://msdn.microsoft.com/en-us/library/ms742521.aspx
Commanding Overview http://msdn.microsoft.com/en-us/library/ms752308.aspx
Creating custom behaviors http://msdn.microsoft.com/en-us/library/ff725476(v=expression.40).aspx
Creating custom triggers and actions http://msdn.microsoft.com/en-us/library/ff725477(v=expression.40).aspx
INotifyPropertyChanged http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx
ObservableCollection http://msdn.microsoft.com/en-us/library/ms668604.aspx

MVVM

View

The view can be a Window, UserControl, Page, DataTemplate, or custom control
A view can be the applications top-level control, a sub-component of a parent view or a DataTemplate for an object in an ItemsControl.

Data

A view’s DataContext is a view model.
The key point is, a view gets its data, binds to commands, or invokes methods on its DataContext.

Passing UI Gestures to the View Model

control’s Command property can be data bound to an ICommand property on the view model

View Model

Exposes Properties with data that implement change notification

Exposes ICommand properties

Exposes methods

Maintains State

Adapting Model Data for the View

Model

data entities, business objects, repositories and services

Data Objects

  • Data transfer objects (DTO)
  • POCOs
  • Generated entity objects
  • Generated proxy objects

Business Logic

  • Repositories
  • Business objects

Change Notification

Validation

To Change the View, set a View Model Property

  • To disable a button; bind to a property
  • To change VisualState; bind to a property
  • To start an animation; bind to a property
  • To show validation errors; bind to a property

For View to Execute Code

  • View CommandSources bind to ICommand properties
  • View behaviors bind to ICommand properties or invoke methods on the view model





XAML

  • markup extension Fill=«{TemplateBinding Background}»


Customization in WPF

  • Properties
  • Content Model
  • Template
  • Custom Control







<Button Width="75" Height="123" VerticalAlignment="Center">
    <StackPanel>
        <Ellipse Fill="Yellow" Width="40" Height="15"/>
    </StackPanel>   
</Button>


  • Events
    Tunneling - top(Root) -> down(target)
    Bubbling - top(wants handle) <- down(target)
    Direct - -> directly to target

  • Commands
    menus, gestures, keys

  • Controls
    Events
    Content Model
    Focus
    Command
    Automation

  • FrameworkElement

  • Template
    ContentPresenter
    ControlTemplate

AttachedProperty
CommmandBinding
DependencyObject
Visual
UiElement
ContentElement
FrameworkElement
FrameworkContentElement

DataBinding

  • DataTemplate
    SomeClass(Properties) -> DataTemplate(Markup with bindings) -> UI

  • DataContexts

INotifyPropertyChanged
INotifyCollectionChanged

XmlDataProvider
ObjectDataProvider

Converters

IValueConverter

Validation

ValidationRule
IDataError

Controls

TextBoxBase <|– TextBox

            <|-- RichTextBox

PasswordBox

TextBlock

RangeBase <|– Slider

        <|-- ProgressBar
        <|-- ScrollBar

ItemsControl <|– Selector <|– ListBox <|– ListView

                            <|--  ComboBox
            <|-- TreeView

MenuItem
Separator

Grid
DockPanel
StackPanel
WrapPanel

Canvas

ScrollViewer
Viewbox

Navigation

Window
Popup

Template

Simple template

<Button Width="75" Height="35">
  <Button.Template>
    <ControlTemplate TargetType="{x:Type Button}">
      <Ellipse Fill="Red" />
    </ControlTemplate>
  </Button.Template>
</Button>

Resources

System resources

<Rectangle Height="40" Margin="10"
           Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />

<Rectangle Height="40" Margin="10"
           Fill="{StaticResource {x:Static SystemColors.HighlightBrushKey}}" />

MergedResources
BinaryResources

GerResourceStream
GetContentStream
GetRemoteStream
LoadComponent

Layout phases

  • Measure
  • Arrange

Layout properties

  • Margin
    space around edge
  • Padding
    space between boundary and content
  • Alignment
  • Size

Graphics

Low-lewel types

Brush

SolidColorBrush
LinearGradientBrush
RadiantGradientBrush

Pen
Point
Rect
Geometry

events, binding, layout, styling, animation

Shape <|– Line

            Rectangle
            Ellipse
            Polyline
            Polygon
            Path

EllipseGeometry
PathGeometry
LineGeometry
RectangleGeometry
GeometryGroup

Path
StreamGeometry
CombinedGeometry

Drawing
DrawingGroup

DrawingBrush
VisualBrush

Image
ImageBrush

Viewbox
Viewport

ImageSource
DrawingImage
BitmapSource

RenderTransform
LayoutTransform
RelativeTransform

SlaceTransform
TranslateTransform
RotateTransform
SkewTransform
TransformGroup
MatrixTransform

Clip
OpacityMask

WPF Combobox

http://msdn.microsoft.com/en-us/library/System.Windows.Controls.ComboBox.aspx

ComboBox Styles and Templates http://msdn.microsoft.com/en-us/library/ms752094.aspx


Back to posts


comments powered by Disqus