Something odd about MCML rules, in my opinion at least..

March 10, 2008

To me the code below makes perfect sense; execute the binding when the conditions are met, thus executing the inner conditions before the outer binding.

<Binding Target=”[Text.Content]” Source=”[Application.MyObject!a:MyDerivedObject.Property]“>
<Conditions>
<IsType Source=”[Application.MyObject]” Type=”a:MyDerivedObject”/>
<IsValid Source=”[Application.MyObject!a:MyDerivedObject.Property]“/>
</Conditions>
</Binding>

But it doen’t work this way in MCML, when the property is invalid, an exception is raised because the binding could not be made. So the parser tries to execute the binding-rule first, instead of the inner conditions.

The proper way to define this rule is:

<Rule>
<Conditions>
<IsType Source=”[Application.MyObject]” Type=”a:MyDerivedObject”/>
<IsValid Source=”[Application.MyObject!a:MyDerivedObject.Property]“/>
<IsModified Source=”[Application.MyObject!a:MyDerivedObject.Property]“/>
</Conditions>
<Actions>
<Set Target=”[Text.Content]” Value=”[Application.MyObject!a:MyDerivedObject.Property]“>
</Actions>
</Rule>

Entry Filed under: MCML, Windows Media Center. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

Categories

Archives

Blogroll

Feeds