WPFCustomControls::Customization::ViewModel::ContextViewModel Class Reference


Detailed Description

ViewModel object for the ContextView UI element.

Manages the current context mode (Always, Never, or Conditional) and establishes a data binding between the TargetItem's TargetProperty and a ContextQuery object when the mode is set to Conditional.

List of all members.

Public Types

enum   ValueMode { Always, Never, Conditional }
 

Mode for the context binding.

More...

Public Member Functions

  ContextViewModel ()
  Constructor.
  ContextViewModel (String propertyLabel, ReverseBinding binding, ReverseBindingStorage storage)
  Constructor generating a ContextViewModel from an existing ReverseBinding.
  ContextViewModel (String propertyLabel, Object targetItem, String targetProperty, IValueConverter converter, ReverseBindingStorage storage)
  Constructor generating a ContextViewModel with all necessary data.
void  UpdateTargetState ()
  Update the current binding to the TargetItem's TargetProperty according to the Mode.

Static Public Attributes

static readonly DependencyProperty  ModeProperty
  The selected ValueMode.
static readonly DependencyProperty  PropertyLabelProperty
  The localized label used in the UI to describe the property under customization.
static readonly DependencyProperty  TargetItemProperty
  The item under customization in the UI.
static readonly DependencyProperty  TargetPropertyProperty
  The property under customization on the TargetItem.
static readonly DependencyProperty  MultiContextQueryProperty
  Current context query customizing the TargetItem's state.
static readonly DependencyProperty  ConverterProperty
  Converter used to convert the context query's result to the targetProperty value.
static readonly DependencyProperty  IntermediateValueProperty
  Intermediate value bound to the TargetItem's TargetProperty when Mode is Always or Never and this ViewModel is active.
static readonly DependencyProperty  ToolTipContentProperty
  Content intended for the ContextView's ToolTip representing the current Conditional Context query.

Protected Member Functions

virtual void  OnModeChanged (DependencyPropertyChangedEventArgs e)
virtual void  OnContextDefinitionChanged ()

Properties

ValueMode  Mode [get, set]
  The selected ValueMode.
String  PropertyLabel [get, set]
  The localized label used in the UI to describe the property under customization.
Object  TargetItem [get, set]
  The item under customization in the UI.
String  TargetProperty [get, set]
  The property under customization on the TargetItem.
MultiContextQuery  MultiContextQuery [get, set]
  Current context query customizing the TargetItem's state.
IValueConverter  Converter [get, set]
  Converter used to convert the context query's result to the targetProperty value.
bool  IntermediateValue [get, set]
  Intermediate value bound to the TargetItem's TargetProperty when Mode is Always or Never and this ViewModel is active.
String  ToolTipContent [get, set]
  Content intended for the ContextView's ToolTip representing the current Conditional Context query.
ReverseBinding  CurrentBinding [get, set]
  Current data binding set to the TargetItem's TargetProperty.
ReverseBindingStorage  ReverseBindingStorage [get, set]
  Storage to persist a Conditional mode ReverseBinding past the interaction with the view.

Events

DependencyPropertyChangedEventHandler  ModeChanged
  Fires when the selected ValueMode changes.
EventHandler  ContextDefinitionChanged

Member Enumeration Documentation

Mode for the context binding.

Always has the context always evaluate to true. Never has the context always evaluate to false. Conditional evaluates the scene context to determine its value.

Enumerator:
Always 
Never 
Conditional 

Constructor & Destructor Documentation

WPFCustomControls::Customization::ViewModel::ContextViewModel::ContextViewModel ( ) [inline]

Constructor.

WPFCustomControls::Customization::ViewModel::ContextViewModel::ContextViewModel ( String  propertyLabel,
ReverseBinding  binding,
ReverseBindingStorage  storage 
) [inline]

Constructor generating a ContextViewModel from an existing ReverseBinding.

Parameters:
propertyLabel The localized label used in the UI to describe the property under customization.
binding Existing ReverseBinding used to populate the View Model's fields.
storage Storage to persist a Conditional mode ReverseBinding past the interaction with the view.
WPFCustomControls::Customization::ViewModel::ContextViewModel::ContextViewModel ( String  propertyLabel,
Object  targetItem,
String  targetProperty,
IValueConverter  converter,
ReverseBindingStorage  storage 
) [inline]

Constructor generating a ContextViewModel with all necessary data.

Parameters:
propertyLabel The localized label used in the UI to describe the property under customization.
targetItem UI Element under customization.
targetProperty Name for the property under customization on targetItem.
converter Converter used to convert the context query's result to the targetProperty value.
storage Storage to persist a Conditional mode ReverseBinding past the interaction with the view.

Member Function Documentation

virtual void WPFCustomControls::Customization::ViewModel::ContextViewModel::OnModeChanged ( DependencyPropertyChangedEventArgs  e ) [inline, protected, virtual]
virtual void WPFCustomControls::Customization::ViewModel::ContextViewModel::OnContextDefinitionChanged ( ) [inline, protected, virtual]
void WPFCustomControls::Customization::ViewModel::ContextViewModel::UpdateTargetState ( ) [inline]

Update the current binding to the TargetItem's TargetProperty according to the Mode.


Member Data Documentation

Initial value:
 
        DependencyProperty.Register(
            "Mode",
            typeof(ValueMode),
            typeof(ContextViewModel),
            new PropertyMetadata(ValueMode.Always, OnModePropertyChanged) )

The selected ValueMode.

Initial value:
        DependencyProperty.Register(
            "PropertyLabel",
            typeof(String),
            typeof(ContextViewModel) )

The localized label used in the UI to describe the property under customization.

The PropertyLabel is propagated to the ContextBuilderWindow's title.

Initial value:
        DependencyProperty.Register(
            "TargetItem",
            typeof(Object),
            typeof(ContextViewModel) )

The item under customization in the UI.

Initial value:
        DependencyProperty.Register(
            "TargetProperty",
            typeof(String),
            typeof(ContextViewModel))

The property under customization on the TargetItem.

Initial value:
        DependencyProperty.Register(
            "MultiContextQuery",
            typeof(MultiContextQuery),
            typeof(ContextViewModel))

Current context query customizing the TargetItem's state.

Initial value:
        DependencyProperty.Register(
            "Converter",
            typeof(IValueConverter),
            typeof(ContextViewModel))

Converter used to convert the context query's result to the targetProperty value.

Initial value:
        DependencyProperty.Register(
            "IntermediateValue",
            typeof(bool),
            typeof(ContextViewModel),
            new PropertyMetadata(true))

Intermediate value bound to the TargetItem's TargetProperty when Mode is Always or Never and this ViewModel is active.

This binding is discarded when the ViewMode is discarded or when the Mode is set to Conditional

Initial value:
 
        DependencyProperty.Register(
            "ToolTipContent",
            typeof(String),
            typeof(ContextViewModel))

Content intended for the ContextView's ToolTip representing the current Conditional Context query.


Property Documentation

ValueMode WPFCustomControls::Customization::ViewModel::ContextViewModel::Mode [get, set]

The selected ValueMode.

String WPFCustomControls::Customization::ViewModel::ContextViewModel::PropertyLabel [get, set]

The localized label used in the UI to describe the property under customization.

The PropertyLabel is propagated to the ContextBuilderWindow's title.

Object WPFCustomControls::Customization::ViewModel::ContextViewModel::TargetItem [get, set]

The item under customization in the UI.

String WPFCustomControls::Customization::ViewModel::ContextViewModel::TargetProperty [get, set]

The property under customization on the TargetItem.

MultiContextQuery WPFCustomControls::Customization::ViewModel::ContextViewModel::MultiContextQuery [get, set]

Current context query customizing the TargetItem's state.

IValueConverter WPFCustomControls::Customization::ViewModel::ContextViewModel::Converter [get, set]

Converter used to convert the context query's result to the targetProperty value.

bool WPFCustomControls::Customization::ViewModel::ContextViewModel::IntermediateValue [get, set]

Intermediate value bound to the TargetItem's TargetProperty when Mode is Always or Never and this ViewModel is active.

This binding is discarded when the ViewMode is discarded or when the Mode is set to Conditional

String WPFCustomControls::Customization::ViewModel::ContextViewModel::ToolTipContent [get, set]

Content intended for the ContextView's ToolTip representing the current Conditional Context query.

ReverseBinding WPFCustomControls::Customization::ViewModel::ContextViewModel::CurrentBinding [get, set]

Current data binding set to the TargetItem's TargetProperty.

Changes when the Mode changes.

ReverseBindingStorage WPFCustomControls::Customization::ViewModel::ContextViewModel::ReverseBindingStorage [get, set]

Storage to persist a Conditional mode ReverseBinding past the interaction with the view.


Event Documentation

DependencyPropertyChangedEventHandler WPFCustomControls::Customization::ViewModel::ContextViewModel::ModeChanged

Fires when the selected ValueMode changes.

EventHandler WPFCustomControls::Customization::ViewModel::ContextViewModel::ContextDefinitionChanged

WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel
WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel WPFCustomControls::Customization::ViewModel::ContextViewModel