I'm working on a project where things aren't build "very well". Because I want create something like a "partial model" for a part of the window where I will put my controls, I would like to know if there is a markup that will allow me to specify its DataContext but doesn't change the window graphic in any way (adding buttons and things like that).
If not, how can I create one by myself (I think by intheriting MarkupExtension), and more important: can be done?
Thanks for any answer
EDIT 1:
An example of my idea is this one:
<SomeControl>
<TextBlock />
<ThisMarkupDoNothing DataContext="{Binding my:Model}">
<ComboBox ItemsSource="{Binding MyModelProperty}" />
</ThisMarkupDoNothing>
</SomeControl>
Maybe this can help understand what I mean.
You could use ContentControl
for that:
<SomeControl>
<TextBlock />
<ContentControl DataContext="{Binding my:Model}">
<ComboBox ItemsSource="{Binding MyModelProperty}" />
</ContentControl>
</SomeControl>
Other options include UserControl
and Border
without actually setting the border properties.