Skip to content

Instantly share code, notes, and snippets.

@SpacePurr
Created February 25, 2020 10:40
Show Gist options
  • Save SpacePurr/b9d3ef76ab46f3237f49ae34f6e3259b to your computer and use it in GitHub Desktop.
Save SpacePurr/b9d3ef76ab46f3237f49ae34f6e3259b to your computer and use it in GitHub Desktop.
tabcontrol
<TabControl Grid.Row="0" ItemsSource="{Binding Models}" SelectedItem="{Binding CurrentTab, Mode=TwoWay}" Loaded="FrameworkElement_OnLoaded" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<ei:CallMethodAction MethodName="Selector_OnSelectionChanged" TargetObject="{Binding}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<TabControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Model.FileName, FallbackValue='3D View', Mode=TwoWay, Converter={StaticResource FileNameConverter}}"/>
<TextBlock Text=" "/>
<Button Style="{StaticResource MaterialDesignIconButton}" Height="12" Width="12" HorizontalAlignment="Right" VerticalAlignment="Top" Command="{Binding CloseCommand}">
<Image Source="/TDMS 3D Control;component/Resources/img_tab_close.ico" RenderOptions.BitmapScalingMode="HighQuality"/>
</Button>
</StackPanel>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate DataType="{x:Type vm:ModelTab}">
<views:ModelView/>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment