In WPF-XAML, determining DataContext at designtime vs runtime.
Why do we have to add “d:DataContext” while we already have set the “DataContext” ?
Why Microsoft introduced DesignTime attributes (code that we have to add, a little bit complex) when it could already be determined automatically by itself using “DataContext” attribute. The only utility that I could see is for a DataContext set in code at RunTime. Otherwise Microsoft could use the DataContext and find the “Shape” of the data like it does with d:DataContext.
What I don’t understand properly ? What I’m missing ?
As yo noted yourself:
In many projects/approaches the DataContext will be set dynamically at runtime.
So you couldn’t know anything about the DataContext at designtime..