alielie
2025-03-11 2e54b439c64e0adbb7e010243c1f33aa5fc5f503
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<UserControl x:Class="WPFProject.Controls.InnerWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:WPFProject.Controls"
             
             mc:Ignorable="d" 
             HorizontalAlignment="Stretch"
             HorizontalContentAlignment="Stretch"
             MouseLeftButtonDown="Grid_MouseLeftButtonDown"
             Background="#FFF"
             Focusable="True">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/HMI.UI;component/Style/colors.xaml"/>
                <ResourceDictionary Source="/HMI.UI;component/Style/WindowResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
 
            <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Label VerticalContentAlignment="Center" 
                                   Background="{StaticResource ChildBorder}" Foreground="{Binding HeaderFontColor}" Content="{Binding Title}"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
 
    <UserControl.Template>
        <ControlTemplate TargetType="UserControl">
            <AdornerDecorator HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                <Grid GotFocus="Grid_GotFocus">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
 
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
 
                        <Thumb Style="{StaticResource SliderThumbStyle}" Grid.Column="0" x:Name="thumb1" DragDelta="DragDelta" 
                           DragStarted="DragStarted" DragCompleted="DragCompleted"/>
 
                        <StackPanel Grid.Column="1" Orientation="Horizontal">
                            <Button Style="{StaticResource ChildWindowButton}" Click="Min_Click">&#xe650;</Button>
                            <Button Style="{StaticResource ChildWindowButton}" Click="Max_Click" >&#xe602;</Button>
                            <Button Style="{StaticResource ChildWindowCloseButton}" Click="CLose_Click">&#xe609;</Button>
                        </StackPanel>
                    </Grid>
 
                    <Border Grid.Row="1" Background="LightGray" VerticalAlignment="Stretch" BorderThickness="2,0,2,2" BorderBrush="{Binding HeaderBackground}">
                        <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></ContentPresenter>
                    </Border>
                </Grid>
            </AdornerDecorator>
        </ControlTemplate>
    </UserControl.Template>
</UserControl>