Answer the question
In order to leave comments, you need to log in
How to create independent tabs in TabControl?
Hello.
It is required to create the functionality of 3D models tabs as in Autocad or any other CAD program.
I'm using a TabControl in WPF, but there's a problem that I can't get around yet due to ignorance or misunderstanding.
Let's move on to the code.
There is some UserControl Model3DView . It contains a DrawingControl3D (I'm using the XBim library) which is the rendering component of the model.
<Grid>
<DrawingControl3D Model={Binding Model}>
//всякое разное
</DrawingControl3D>
</Grid>
<TabControl ItemsSource="{Binding Models}" SelectedItem="{Binding CurrentTab, Mode=TwoWay}">
<TabControl.ItemTemplate>
<DataTemplate>
//Заголовок
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate DataType="{x:Type vm:Model3DTab}">
<views:Model3DView/>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
var hiddens = new List<IPersistEntity>{ entity };
drawingControl3D.HiddenInstances = hiddens;
drawingControl3D.ReloadModel();
<i:EventTrigger EventName="Loaded">
<ei:CallMethodAction MethodName="DrawingControl3D_OnLoaded" TargetObject="{Binding}"/>
</i:EventTrigger>
Answer the question
In order to leave comments, you need to log in
TabItem caching issue, most likely.
Try to use
<TabControl b:TabContent.IsCached=“True”>
</TabControl>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question