Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It may be more in line with MVVM to do 2 Views (data templates). Just do them as generics in the control resources.</p> <pre><code>&lt;TabControl&gt; &lt;TabControl.Resources&gt; &lt;DataTemplate DataType="EditorTabViewModel"&gt; &lt;Button Content="Enabled for Editor only" IsEnabled=True Command=SomeCommand /&gt; &lt;Button Content="Enabled for Preview only" IsEnabled=False Command=SomeCommand /&gt; &lt;/DataTemplate/&gt; &lt;DataTemplate DataType="PreviewTabViewModel"&gt; &lt;Button Content="Enabled for Editor only" IsEnabled=False Command=SomeCommand /&gt; &lt;Button Content="Enabled for Preview only" IsEnabled=True Command=SomeCommand /&gt; &lt;/DataTemplate&gt; &lt;/TabControl.Resources&gt; &lt;TabControl.ItemTemplate&gt; &lt;DataTemplate DataType="TabViewModel"&gt; &lt;TextBlock Text="{Binding SomeValueToShowAsHeader}" /&gt; &lt;/DataTemplate&gt; &lt;/TabControl.ItemTemplate&gt; &lt;/TabControl&gt; </code></pre> <p>So what happens is all the tabs have the same tab header, because the itemtemplate is explicitly defined. But because the ContentTemplates are not explicitly defined, when the control looks for a template for the content, it will give it the default template for the domain. Since we define 2 default templates, one for EditorTabViewModel and one for PreviewTabViewModel, when it comes across one of these, it will assign it to that data template. This should result in two different displays showing in the tab collection. I havent tried it fully with tab viewmodel so let me know if it doesnt work as expected.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload