Вопрос

Can one say that Markup Extensions are XAML's way of incorporating procedural programming? What do you think the limitations of this statement are?

For example if you compare it pure XML, the Markup extensions are like "action elements" in a way, they are not quite part of the object tree.

Это было полезно?

Решение

Some Markup Extensions are just a more in-place way of describing what can be done by making more extensive use of tags (so their usage is declarative as hell):

<TextBox Text="{Binding Path=Foo}">

is equivalent to

<TextBox>
  <TextBox.Text>
   <Binding Path="Foo">
  </TextBox.Text>
</TextBox>

As for Extensions in general...see here. The {}-Syntax just dictates the compiler to use an instance of the corresponding extension type to handle the code in between. This, of course, is object oriented code and never not procedural in no way ever ever. Believe it or not - even people at M$ know how to code decently!

Другие советы

No, it's purely declarative. It is in no way procedural.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top