added MergedDictionaries in Generic.xaml to split custom controls in seperate xaml files,

implemented add button visually in ExtendedTabControl
master
Jonas Arnold 3 years ago
parent 59f674f663
commit b0e63d0437
  1. 9
      MultiTerm.Wpf.CustomControl/ExtendedTabControl/ExtendedTabControl.xaml
  2. 12
      MultiTerm.Wpf.CustomControl/Themes/Generic.xaml
  3. 1
      MultiTerm.Wpf/MultiTerm.Wpf.csproj
  4. 15
      MultiTerm.Wpf/View/ShellView.xaml

@ -1,10 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MultiTerm.Wpf.CustomControl"> xmlns:local="clr-namespace:MultiTerm.Wpf.CustomControl">
<SolidColorBrush x:Key="TabItem.Selected.Background" Color="#FFFFFF"/> <SolidColorBrush x:Key="TabItem.Selected.Background" Color="#FFFFFF"/>
<SolidColorBrush x:Key="TabItem.Selected.Border" Color="#ACACAC"/> <SolidColorBrush x:Key="TabItem.Selected.Border" Color="#ACACAC"/>
<Style x:Key="TabControlStyle1" TargetType="{x:Type local:ExtendedTabControl}"> <Style TargetType="{x:Type local:ExtendedTabControl}">
<Setter Property="Padding" Value="2"/> <Setter Property="Padding" Value="2"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
@ -24,7 +24,10 @@
<RowDefinition x:Name="RowDefinition0" Height="Auto"/> <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
<RowDefinition x:Name="RowDefinition1" Height="*"/> <RowDefinition x:Name="RowDefinition1" Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TabPanel x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="2,2,2,0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/> <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0">
<TabPanel x:Name="headerPanel" Background="Transparent" IsItemsHost="true" Margin="2,2,2,0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
<Button Margin="2,2,2,2" Height="{TemplateBinding Height}" Width="{TemplateBinding Height}">+</Button>
</StackPanel>
<Border x:Name="contentPanel" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local"> <Border x:Name="contentPanel" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border> </Border>

@ -0,0 +1,12 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MultiTerm.Wpf.CustomControl">
<!-- below all xaml files for custom controls shall be added -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/MultiTerm.Wpf.CustomControl;component/ExtendedTabControl/ExtendedTabControl.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

@ -15,6 +15,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" /> <ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\MultiTerm.Core\MultiTerm.Core.csproj" /> <ProjectReference Include="..\MultiTerm.Core\MultiTerm.Core.csproj" />
<ProjectReference Include="..\MultiTerm.Wpf.CustomControl\MultiTerm.Wpf.CustomControl.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -6,6 +6,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:conv="clr-namespace:MultiTerm.Wpf.ValueConverters" xmlns:conv="clr-namespace:MultiTerm.Wpf.ValueConverters"
xmlns:controls="clr-namespace:MultiTerm.Wpf.Controls" xmlns:controls="clr-namespace:MultiTerm.Wpf.Controls"
xmlns:custom_controls="clr-namespace:MultiTerm.Wpf.CustomControl;assembly=MultiTerm.Wpf.CustomControl"
xmlns:vm="clr-namespace:MultiTerm.Core.ViewModel;assembly=MultiTerm.Core" xmlns:vm="clr-namespace:MultiTerm.Core.ViewModel;assembly=MultiTerm.Core"
xmlns:v="clr-namespace:MultiTerm.Wpf.View" xmlns:v="clr-namespace:MultiTerm.Wpf.View"
xmlns:core_common="clr-namespace:MultiTerm.Core.Common;assembly=MultiTerm.Core" xmlns:core_common="clr-namespace:MultiTerm.Core.Common;assembly=MultiTerm.Core"
@ -125,13 +126,13 @@
<RibbonSeparator/> <RibbonSeparator/>
</RibbonMenuButton>--> </RibbonMenuButton>-->
</StackPanel> </StackPanel>
<TabControl DockPanel.Dock="Right" <custom_controls:ExtendedTabControl DockPanel.Dock="Right"
x:Name="terminalTabControl" x:Name="terminalTabControl"
ItemsSource="{Binding TerminalViewModels}" ItemsSource="{Binding TerminalViewModels}"
SelectedItem="{Binding SelectedTerminalViewModel}"> SelectedItem="{Binding SelectedTerminalViewModel}">
<!-- Tab Template --> <!-- Tab Template -->
<TabControl.ItemTemplate> <custom_controls:ExtendedTabControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Title, Mode=OneWay}" /> <TextBlock Text="{Binding Title, Mode=OneWay}" />
@ -146,14 +147,14 @@
</Button> </Button>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</TabControl.ItemTemplate> </custom_controls:ExtendedTabControl.ItemTemplate>
<!-- Register additional Tab ViewModels here --> <!-- Register additional Tab ViewModels here -->
<TabControl.Resources> <custom_controls:ExtendedTabControl.Resources>
<DataTemplate DataType="{x:Type vm:SendReceiveViewModel}"> <DataTemplate DataType="{x:Type vm:SendReceiveViewModel}">
<v:SendReceiveView/> <v:SendReceiveView/>
</DataTemplate> </DataTemplate>
</TabControl.Resources> </custom_controls:ExtendedTabControl.Resources>
</TabControl> </custom_controls:ExtendedTabControl>
</DockPanel> </DockPanel>
</UserControl> </UserControl>

Loading…
Cancel
Save