DocumentControl.axaml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <ResourceDictionary xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:suki="https://github.com/kikipoulet/SukiUI"
  4. xmlns:core="using:Dock.Model.Core"
  5. xmlns:dmc="using:Dock.Model.Controls">
  6. <Design.PreviewWith>
  7. <DocumentControl Width="300" Height="400" />
  8. </Design.PreviewWith>
  9. <ControlTheme x:Key="{x:Type DocumentControl}" TargetType="DocumentControl">
  10. <Setter Property="HeaderTemplate">
  11. <DataTemplate DataType="core:IDockable">
  12. <TextBlock Padding="2" Text="{Binding Title}" />
  13. </DataTemplate>
  14. </Setter>
  15. <Setter Property="Template">
  16. <ControlTemplate>
  17. <suki:GlassCard Margin="5" Padding="12,15">
  18. <DockPanel x:Name="PART_DockPanel"
  19. x:CompileBindings="True"
  20. x:DataType="dmc:IDocumentDock"
  21. Background="Transparent"
  22. DockProperties.IsDockTarget="True"
  23. DockProperties.IsDropArea="True"
  24. ZIndex="1">
  25. <DocumentTabStrip x:Name="PART_TabStrip"
  26. CanCreateItem="{Binding CanCreateDocument}"
  27. DockPanel.Dock="Top"
  28. DockProperties.IsDropArea="True"
  29. IsActive="{TemplateBinding IsActive}"
  30. ItemsSource="{Binding VisibleDockables}"
  31. SelectedItem="{Binding ActiveDockable, Mode=TwoWay}">
  32. <DocumentTabStrip.Styles>
  33. <Style Selector="DocumentTabStripItem">
  34. <Setter Property="IsActive" Value="{Binding $parent[DocumentTabStrip].IsActive}" />
  35. </Style>
  36. </DocumentTabStrip.Styles>
  37. </DocumentTabStrip>
  38. <Grid x:Name="PART_Grid" IsVisible="{Binding #PART_TabStrip.IsVisible}" />
  39. <Border x:Name="PART_Border">
  40. <DockableControl DataContext="{Binding ActiveDockable}" TrackingMode="Visible">
  41. <ContentControl x:Name="PART_ContentPresenter"
  42. HorizontalAlignment="Stretch"
  43. VerticalAlignment="Stretch"
  44. Content="{Binding}">
  45. <ContentControl.ContentTemplate>
  46. <ControlRecyclingDataTemplate Parent="{Binding #PART_ContentPresenter}" />
  47. </ContentControl.ContentTemplate>
  48. </ContentControl>
  49. </DockableControl>
  50. </Border>
  51. </DockPanel>
  52. </suki:GlassCard>
  53. </ControlTemplate>
  54. </Setter>
  55. <Style Selector="^/template/ Grid#PART_Grid">
  56. <Setter Property="Background" Value="{DynamicResource DockThemeBorderLowBrush}" />
  57. <Setter Property="Height" Value="0" />
  58. <Setter Property="DockPanel.Dock" Value="Top" />
  59. </Style>
  60. <Style Selector="^:active /template/ Grid#PART_Grid">
  61. <Setter Property="Background" Value="{DynamicResource DockApplicationAccentBrushLow}" />
  62. </Style>
  63. <Style Selector="^/template/ Border#PART_Border">
  64. <Setter Property="BorderBrush" Value="{DynamicResource DockThemeBorderLowBrush}" />
  65. <Setter Property="BorderThickness" Value="0" />
  66. </Style>
  67. </ControlTheme>
  68. </ResourceDictionary>