I asked a question earlier regarding
<Button Command="{StaticResource hwc}" CommandParameter="Hello" ...
in which to overcome my problem i was asked to switch the place of these two attributes i.e. CommandParameter
should come first and Command` later. This way
<Button CommandParameter="Hello" Command="{StaticResource hwc}" ...
No doubt, this thing worked. But left a few questions in my mind.
- Do the order of attributes matter?
- Does this same principle apply to styles also. My seniors at job say styles should be written/defined in a file before they are used
I have a button designed
<Button Style="{StaticResource FooStyle}" ....
and the style is defined way down below after this button is declared
<Style x:Key="FooStyle" TargetType="{x:Type Path}" ...
Will this style be applied to that button even though it is declared after button is declared?
In code behind we cannot use a variable before its declaration, so does the same apply to XAML code also?