Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here
Craig Sutherland: Considering XAML for Config for CruiseControl.NET

Interesting to see “From NetReflector to XAML” from Craig Sutherland detailing an exploration of using XAML for Config for CruiseControl.NET.

WPF’s XamlReader.Load vs System.Xaml’s XamlServices.Load()

CS: “although from what I understand WPF will still have its own implementation”

RR: WPF 4’s API XamlReader.Load’s goal is to be compatible, yet better, than the WPF 3 version of XamlReader.Load. This call does some special things for WPF (see Mike Shim’s “Use XamlReader.Load for WPF XAML (not XamlServices.Load)” for details. For Config scenarios, XamlServices.Load/Save would be ideal…that is what I do wth XamlPadSample as detailed in “Persistable View Models & XAML for Config

Representing Time

Craig shows the use of a markupextension for Time: {Time 5} or {Time 30, Unit=Minutes}, etc…

A few options to consider (for Interval.Period, SubVersion.Timeout, Project.ModificationDelay, etc…) would be:

  • Keep using the {Time} markupextension. Decent readability…
  • Make those properties of type TimeSpan, which has a type converter that will convert to/from a string – see DoubleAnimation.Duration, for example:

<DoubleAnimation Storyboard.TargetName="MyAnimatedRectangle" Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="0:0:5" AutoReverse="True" RepeatBehavior="Forever" />

  • Keep those property of type Int32, but use a “A Type Converter Declared on a Property” (see “Strings to Things (or How XAML interprets Attribute Values”) to introduce a TypeConverter than knows how to convert a string representing a time to integers. Similar approach allows UIElement.Height/.Width use “1in”, “96px”, etc…
Published Friday, February 12, 2010 1:02 AM by Rob_Relyea
Filed under:

Comments

# Dew Drop &ndash; February 12, 2010 | Alvin Ashcraft&#039;s Morning Dew@ Friday, February 12, 2010 8:59 AM

Pingback from  Dew Drop &ndash; February 12, 2010 | Alvin Ashcraft&#039;s Morning Dew

# re: Craig Sutherland: Considering XAML for Config for CruiseControl.NET@ Sunday, February 14, 2010 7:55 PM

Hi Rob,

Thanks for the feedback.

For the time conversion, is it possible to have both a markup extension and the type converter? I.e. could I give people the option of using either syntax? While I like the idea of using a TimeSpan for the underlying data type, I like to be able to explicitly define the units.

Craig

# re: Craig Sutherland: Considering XAML for Config for CruiseControl.NET@ Monday, February 15, 2010 5:22 AM

Craig-

Yes, you could choose TimeSpan or Int32 (with property level type converter) and you'd still be able to use your Time markup extension.

All values will be treated as a type convertable value, unless a markup extension is specified via the curly brace syntax.

Thanks, Rob

# Handling Intervals ??? the XAML Way &laquo; Automated Coder@ Monday, February 22, 2010 2:11 AM

Pingback from  Handling Intervals ??? the XAML Way &laquo; Automated Coder

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Page view counter