- aggiunta EffectorWindow con TitleBar

- Utilizzata EffectorWindow per MultipleCopyWnd
- Utilizzata BaseWindow per ProcessManagerV
- aggiunto titolo a TitleBar
- aggiunto modulo Converters
This commit is contained in:
Emmanuele Sassi
2025-02-26 15:01:11 +01:00
parent 54e2f27a44
commit dcaef9eaa9
9 changed files with 290 additions and 135 deletions
@@ -0,0 +1,42 @@
' Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
'
' Step 1a) Using this custom control in a XAML file that exists in the current project.
' Add this XmlNamespace attribute to the root element of the markup file where it is
' to be used:
'
' xmlns:MyNamespace="clr-namespace:Effector.Plugin.Lib"
'
'
' Step 1b) Using this custom control in a XAML file that exists in a different project.
' Add this XmlNamespace attribute to the root element of the markup file where it is
' to be used:
'
' xmlns:MyNamespace="clr-namespace:Effector.Plugin.Lib;assembly=Effector.Plugin.Lib"
'
' You will also need to add a project reference from the project where the XAML file lives
' to this project and Rebuild to avoid compilation errors:
'
' Right click on the target project in the Solution Explorer and
' "Add Reference"->"Projects"->[Browse to and select this project]
'
'
' Step 2)
' Go ahead and use your control in the XAML file. Note that Intellisense in the
' XML editor does not currently work on custom controls and its child elements.
'
' <MyNamespace:EffectorWindow/>
'
Imports System.Windows.Controls.Primitives
Imports EgwWPFBaseLib
Public Class EffectorWindow
Inherits EgwWPFBaseLib.EgtWindow
Shared Sub New()
'This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
'This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata(GetType(EffectorWindow), new FrameworkPropertyMetadata(GetType(EffectorWindow)))
End Sub
End Class
@@ -1,109 +1,8 @@
<local:EgtWindow x:Class="EffectorWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.Lib"
TitleBarHeight="40">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type Lib:EgtWindow}}}"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
Grid.ColumnSpan="6"
BorderThickness="0"
BorderBrush="{StaticResource Effector_Blue}"
Background="{StaticResource Effector_Blue}"/>
<Image Grid.Column="0"
MinWidth="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
Source="/Resources/Effector.ico"/>
<ContentControl Grid.Column="1"
Content="{Binding ContentMenu}"/>
<TextBlock Grid.Column="2"
Margin="4 0 0 0"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="14"
Text="{Binding sTitle}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="False">
<Setter Property="Foreground" Value="{DynamicResource WindowTitleBarInactiveText}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Button Grid.Column="3"
Click="OnMinimizeButtonClick"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBar_Button}">
<Path Width="46"
Height="32"
Data="M 18,15 H 28"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>
<Button Name="MaximizeBtn"
Grid.Column="4"
Click="OnMaximizeRestoreButtonClick">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource TitleBar_Button}">
<Style.Resources>
<Grid x:Key="max">
<Path Width="46"
Height="32"
Data="M 18.5,12.5 H 25.5 V 19.5 H 18.5 Z M 20.5,12.5 V 10.5 H 27.5 V 17.5 H 25.5"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Grid>
<Grid x:Key="normal">
<Path Width="46"
Height="32"
Data="M 18.5,10.5 H 27.5 V 19.5 H 18.5 Z"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Grid>
</Style.Resources>
<Style.Triggers>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:EffectorWindowV}}}" Value="Maximized">
<Setter Property="Content" Value="{StaticResource max}" />
</DataTrigger>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:EffectorWindowV}}}" Value="Normal">
<Setter Property="Content" Value="{StaticResource normal}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button Grid.Column="5"
Click="OnCloseButtonClick"
Style="{StaticResource TitleBar_Button}">
<Path Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>
</Grid>
<ContentPresenter Grid.Row="1"/>
</Grid>
</local:EgtWindow>
<EgwWPFBaseLib:EgtWindow x:Class="EffectorWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgwWPFBaseLib="clr-namespace:EgwWPFBaseLib;assembly=EgwWPFBaseLib"
xmlns:local="clr-namespace:Effector.Plugin.Lib"
TitleBarHeight="40"
Style="{StaticResource Effector_Window}">
</EgwWPFBaseLib:EgtWindow>