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. .
Trackback this post | Subscribe to the comments via RSS Feed