Call VisualStateManager.GoToState(control, strStateName, useTransitions)
strStateName is mapped to a TemplateVisualStateAttribute of the control class.
Saturday, November 3, 2012
Thursday, October 18, 2012
PrintDocument
sample: http://web.archive.org/web/20101128170826/http://silverlightips.net/2010/03/27/multi-page-printing-in-silverlight/
including:
PrintDocument .PrintPage (event) .Print (method)
PrintPageEventArgs .PageVisual (UIElement) .PrintableArea (Size) .HasMorePages
Also usage of Canvas.TopProperty in SetValue
including:
PrintDocument .PrintPage (event) .Print (method)
PrintPageEventArgs .PageVisual (UIElement) .PrintableArea (Size) .HasMorePages
Also usage of Canvas.TopProperty in SetValue
Tuesday, October 16, 2012
TemplateBindings
TemplateBindings are special bindings usable only in ControlTemplates (no DataTemplates), whose binding source is the control instance on which the template is applied.http://forums.silverlight.net/t/158826.aspx/1
Monday, October 15, 2012
Dependency Properties vs. Attached Properties
Attached Properties use an accessor style that XAML parser can use, i.e. SetPropertyName
As opposed to regular dependency properties that use regular Set/Get accessors.
For attached properties see: http://msdn.microsoft.com/en-us/library/cc265152(v=vs.95).aspx
For regular dependency property requirements see Checklist for Defining a Dependency Property
Nice sample of custom dependency object here (bottom)
As opposed to regular dependency properties that use regular Set/Get accessors.
For attached properties see: http://msdn.microsoft.com/en-us/library/cc265152(v=vs.95).aspx
For regular dependency property requirements see Checklist for Defining a Dependency Property
Nice sample of custom dependency object here (bottom)
Silverlight 4 Validation
This two-part series sums it up:
http://www.silverlightshow.net/items/The-validation-story-in-Silverlight-Part-1.aspx
http://www.silverlightshow.net/items/The-validation-story-in-Silverlight-Part-2.aspx
SL 3 supports ValidatesOnExceptions=True, NotifyOnValidationError=True
Throw exceptions in setters. Optionally use validation attributes on model properties: this requires Validator.ValidateProperty(value, new ValidationContext... in setter
Can use CustomValidation attribute and sdk:ValidationSummary tag
SL4 introduces IDataErrorInfo plus ValidatesOnDataErrors=True tag
and INotifyDataErrorInfo plus ValidatesOnNotifyDataErrors=True
Can customize the validation states in Blend: Default transition, Valid, InvalidUnfocused, InvalidFocused
http://www.silverlightshow.net/items/The-validation-story-in-Silverlight-Part-1.aspx
http://www.silverlightshow.net/items/The-validation-story-in-Silverlight-Part-2.aspx
SL 3 supports ValidatesOnExceptions=True, NotifyOnValidationError=True
Throw exceptions in setters. Optionally use validation attributes on model properties: this requires Validator.ValidateProperty(value, new ValidationContext... in setter
Can use CustomValidation attribute and sdk:ValidationSummary tag
SL4 introduces IDataErrorInfo plus ValidatesOnDataErrors=True tag
and INotifyDataErrorInfo plus ValidatesOnNotifyDataErrors=True
Can customize the validation states in Blend: Default transition, Valid, InvalidUnfocused, InvalidFocused
Sunday, October 14, 2012
Easing Functions - XAML Syntax
DoubleAnimation...DoubleAnimation.EasingFunction vs. DoubleAnimationUsingKeyFrames...EasingDoubleKeyFrame
Samples here
Samples here
In the previous example, the easing functions are applied to a From/To/By animation. You can also apply these easing functions to Key-Frame animations using either EasingDoubleKeyFrame, EasingPointKeyFrame, or EasingColorKeyFrame
Tuesday, October 9, 2012
Sunday, October 7, 2012
Attached Properties are DependencyProperties
See "Attached Properties" at http://www.wpftutorial.net/dependencyproperties.html
Saturday, October 6, 2012
DoubleAnimation, DoubleAnimationUsingKeyFrames
- DoubleAnimation - Uses a From/To direction.
- DoubleAnimationUsingKeyFrames - This is a container for a set of key frames that will determine the value at a given set of points along a time line. We will look at this option in our next tip of the day.
Friday, October 5, 2012
DependencyObject/DependencyProperty
DependencyProperty's (e.g. a Canvas' left, right) are assigned to DependencyObjects, e.g. UI elements. http://blog.hackedbrain.com/2004/12/04/understanding-dependencyobject-and-dependencyproperty/
Example usage of DependencyProperty to add second ContentPresenter to a ControlTemplate
Example usage of DependencyProperty to add second ContentPresenter to a ControlTemplate
For the uncommon cases where a settable property on a DependencyObject is not a dependency property, that property will be unable to support animation, data binding, or FrameworkElement styling.http://msdn.microsoft.com/en-us/library/cc221408(v=vs.95).aspx
Tuesday, October 2, 2012
XAML Concepts
See http://msdn.microsoft.com/en-us/library/ms752059.aspx for descriptions of:
XAML Object Elements (represent WPF types)
Property Element Syntax (vs Attribute Syntax)
Markup Extensions - for setting property dynamically at runtime
Type Converters (e.g. Margin/Thickness)
Sunday, September 30, 2012
Saturday, September 29, 2012
itemscontrol itemspresenter listbox
http://stackoverflow.com/questions/3723893/itemscontrol-itemspanel-and-itemspresenter-silverlight-xaml
Note, ex on itemspanel "Basically, the ItemPresenter (specified in the Template) will be replaced with whatever is specified in the ItemsPanelTemplate." -mmmmmm
Note, ex on itemspanel "Basically, the ItemPresenter (specified in the Template) will be replaced with whatever is specified in the ItemsPanelTemplate." -mmmmmm
Subscribe to:
Posts (Atom)