mirror of
https://github.com/egmont11/NetworkDiagram.git
synced 2026-07-24 07:09:43 +02:00
Did some design changes
This commit is contained in:
@@ -8,6 +8,195 @@
|
|||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="Localization/Strings.en.xaml"/>
|
<ResourceDictionary Source="Localization/Strings.en.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
<!-- Color Palette -->
|
||||||
|
<SolidColorBrush x:Key="PrimaryBlue" Color="#004578"/>
|
||||||
|
<SolidColorBrush x:Key="AccentBlue" Color="#0078D7"/>
|
||||||
|
<SolidColorBrush x:Key="LightBlue" Color="#E1EEFA"/>
|
||||||
|
<SolidColorBrush x:Key="GridBlue" Color="#D0E2F2"/>
|
||||||
|
<SolidColorBrush x:Key="BgWhite" Color="#F5F9FF"/>
|
||||||
|
<SolidColorBrush x:Key="TextDark" Color="#1B1B1B"/>
|
||||||
|
<SolidColorBrush x:Key="TextLight" Color="#FFFFFF"/>
|
||||||
|
<SolidColorBrush x:Key="BorderGray" Color="#CCCCCC"/>
|
||||||
|
|
||||||
|
<!-- Modern Button Style -->
|
||||||
|
<Style x:Key="ModernButtonStyle" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="{StaticResource AccentBlue}"/>
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource TextLight}"/>
|
||||||
|
<Setter Property="Padding" Value="12,6"/>
|
||||||
|
<Setter Property="Margin" Value="4"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="4">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#005A9E"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#004578"/>
|
||||||
|
<Setter TargetName="border" Property="RenderTransform">
|
||||||
|
<Setter.Value>
|
||||||
|
<ScaleTransform ScaleX="0.98" ScaleY="0.98" CenterX="20" CenterY="10"/>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Secondary Button Style -->
|
||||||
|
<Style x:Key="SecondaryButtonStyle" TargetType="Button" BasedOn="{StaticResource ModernButtonStyle}">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource PrimaryBlue}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource PrimaryBlue}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="4">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#D0E2F2"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#B0C2D2"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Header Button Style -->
|
||||||
|
<Style x:Key="HeaderButtonStyle" TargetType="Button" BasedOn="{StaticResource ModernButtonStyle}">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Foreground" Value="White"/>
|
||||||
|
<Setter Property="Opacity" Value="0.9"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="4">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8,4"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#20FFFFFF"/>
|
||||||
|
<Setter Property="Opacity" Value="1"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#40FFFFFF"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Modern TextBox Style -->
|
||||||
|
<Style TargetType="TextBox">
|
||||||
|
<Setter Property="Padding" Value="8,6"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource BorderGray}"/>
|
||||||
|
<Setter Property="Background" Value="White"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="TextBox">
|
||||||
|
<Border x:Name="border"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="4">
|
||||||
|
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsFocused" Value="True">
|
||||||
|
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource AccentBlue}"/>
|
||||||
|
<Setter TargetName="border" Property="BorderThickness" Value="1.5"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Modern ComboBox Style -->
|
||||||
|
<Style TargetType="ComboBox">
|
||||||
|
<Setter Property="Padding" Value="8,4"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource BorderGray}"/>
|
||||||
|
<Setter Property="Background" Value="White"/>
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Modern ListBox Style (for Sidebar) -->
|
||||||
|
<Style x:Key="SidebarListBoxStyle" TargetType="ListBox">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="ItemContainerStyle">
|
||||||
|
<Setter.Value>
|
||||||
|
<Style TargetType="ListBoxItem">
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
<Setter Property="Margin" Value="4"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
|
<Border x:Name="border"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
CornerRadius="6"
|
||||||
|
Padding="4">
|
||||||
|
<ContentPresenter />
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#150078D7"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter TargetName="border" Property="Background" Value="#250078D7"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Device Container Style -->
|
||||||
|
<Style x:Key="DeviceContainerStyle" TargetType="Border">
|
||||||
|
<Setter Property="CornerRadius" Value="8"/>
|
||||||
|
<Setter Property="Padding" Value="4"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="2"/>
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="#100078D7"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<Window x:Class="NetworkDiagram.EditDeviceWindow"
|
<Window x:Class="NetworkDiagram.EditDeviceWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
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"
|
||||||
Title="{DynamicResource EditTitle}" Height="350" Width="400"
|
Title="{DynamicResource EditTitle}" Height="380" Width="420"
|
||||||
WindowStartupLocation="CenterOwner" ResizeMode="NoResize"
|
WindowStartupLocation="CenterOwner" ResizeMode="NoResize"
|
||||||
Background="#F5F9FF">
|
Background="{StaticResource BgWhite}"
|
||||||
<Grid Margin="20">
|
WindowStyle="ThreeDBorderWindow">
|
||||||
|
<Grid Margin="25">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
@@ -13,16 +14,17 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<TextBlock Text="{DynamicResource DeviceNameLabel}" Margin="0,0,0,5"/>
|
<TextBlock Text="{DynamicResource DeviceNameLabel}" Margin="0,0,0,8" FontWeight="SemiBold" Foreground="{StaticResource PrimaryBlue}"/>
|
||||||
<TextBox x:Name="NameBox" Grid.Row="1" Margin="0,0,0,15" Padding="5"/>
|
<TextBox x:Name="NameBox" Grid.Row="1" Margin="0,0,0,20"/>
|
||||||
|
|
||||||
<TextBlock Grid.Row="2" Text="{DynamicResource IpLabel}" Margin="0,0,0,5"/>
|
<TextBlock Grid.Row="2" Text="{DynamicResource IpLabel}" Margin="0,0,0,8" FontWeight="SemiBold" Foreground="{StaticResource PrimaryBlue}"/>
|
||||||
<TextBox x:Name="IpBox" Grid.Row="3" Margin="0,0,0,15" Padding="5"
|
<TextBox x:Name="IpBox" Grid.Row="3" Margin="0,0,0,25"
|
||||||
AcceptsReturn="True" VerticalScrollBarVisibility="Auto"/>
|
AcceptsReturn="True" VerticalScrollBarVisibility="Auto" MinHeight="80"/>
|
||||||
|
|
||||||
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button Content="{DynamicResource CancelBtn}" Click="Cancel_Click" Width="80" Margin="0,0,10,0" Padding="5"/>
|
<Button Content="{DynamicResource CancelBtn}" Style="{StaticResource SecondaryButtonStyle}" Click="Cancel_Click" Width="90" Margin="0,0,12,0"/>
|
||||||
<Button Content="{DynamicResource SaveDialogBtn}" Click="Save_Click" Width="80" Padding="5" Background="#0078D7" Foreground="White"/>
|
<Button Content="{DynamicResource SaveDialogBtn}" Style="{StaticResource ModernButtonStyle}" Click="Save_Click" Width="90"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
||||||
|
|||||||
@@ -6,70 +6,65 @@
|
|||||||
xmlns:local="clr-namespace:NetworkDiagram"
|
xmlns:local="clr-namespace:NetworkDiagram"
|
||||||
xmlns:models="clr-namespace:NetworkDiagram.Models"
|
xmlns:models="clr-namespace:NetworkDiagram.Models"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="{DynamicResource AppTitle}" Height="700" Width="1080"
|
Title="{DynamicResource AppTitle}" Height="750" Width="1100"
|
||||||
Background="#F5F9FF"
|
Background="{StaticResource BgWhite}"
|
||||||
KeyDown="Window_KeyDown">
|
KeyDown="Window_KeyDown">
|
||||||
|
|
||||||
<Window.Resources>
|
|
||||||
<SolidColorBrush x:Key="HeaderBlue" Color="#004578"/>
|
|
||||||
<SolidColorBrush x:Key="AccentBlue" Color="#0078D7"/>
|
|
||||||
<SolidColorBrush x:Key="SidebarBlue" Color="#E1EEFA"/>
|
|
||||||
<SolidColorBrush x:Key="CanvasGridBlue" Color="#D0E2F2"/>
|
|
||||||
|
|
||||||
<Style x:Key="ModernButton" TargetType="Button">
|
|
||||||
<Setter Property="Background" Value="{StaticResource AccentBlue}"/>
|
|
||||||
<Setter Property="Foreground" Value="White"/>
|
|
||||||
<Setter Property="Padding" Value="10,5"/>
|
|
||||||
<Setter Property="Margin" Value="5"/>
|
|
||||||
<Setter Property="BorderThickness" Value="0"/>
|
|
||||||
<Setter Property="Cursor" Value="Hand"/>
|
|
||||||
</Style>
|
|
||||||
</Window.Resources>
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="220"/>
|
<ColumnDefinition Width="240"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="60"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Border Grid.Row="0" Grid.ColumnSpan="2" Background="{StaticResource HeaderBlue}" Padding="10">
|
<!-- Header -->
|
||||||
<DockPanel>
|
<Border Grid.Row="0" Grid.ColumnSpan="2" Background="{StaticResource PrimaryBlue}" VerticalAlignment="Stretch">
|
||||||
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
|
<Border.Effect>
|
||||||
<TextBlock Text="{DynamicResource AppTitle}" Foreground="White" FontSize="18" FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,20,0"/>
|
<DropShadowEffect BlurRadius="10" ShadowDepth="2" Opacity="0.3"/>
|
||||||
<Button Content="{DynamicResource NewBtn}" Style="{StaticResource ModernButton}" Click="NewDiagram_Click"/>
|
</Border.Effect>
|
||||||
<Button Content="{DynamicResource SaveBtn}" Style="{StaticResource ModernButton}" Click="SaveDiagram_Click"/>
|
<DockPanel Margin="15,0">
|
||||||
<Button Content="{DynamicResource LoadBtn}" Style="{StaticResource ModernButton}" Click="LoadDiagram_Click"/>
|
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center">
|
||||||
<Button Content="{DynamicResource ExportBtn}" Style="{StaticResource ModernButton}" Click="ExportPng_Click"/>
|
<TextBlock Text="{DynamicResource AppTitle}" Foreground="White" FontSize="20" FontWeight="Bold" Margin="0,0,30,0"/>
|
||||||
<Separator Margin="10,0" Background="White" Opacity="0.5"/>
|
|
||||||
<Button Content="{DynamicResource WireBtn}" Style="{StaticResource ModernButton}" Click="WireTool_Click"/>
|
<Button Content="{DynamicResource NewBtn}" Style="{StaticResource HeaderButtonStyle}" Click="NewDiagram_Click"/>
|
||||||
<Button Content="{DynamicResource WifiBtn}" Style="{StaticResource ModernButton}" Click="WifiTool_Click"/>
|
<Button Content="{DynamicResource SaveBtn}" Style="{StaticResource HeaderButtonStyle}" Click="SaveDiagram_Click"/>
|
||||||
<Button Content="{DynamicResource AddTextBtn}" Style="{StaticResource ModernButton}" Click="AddText_Click"/>
|
<Button Content="{DynamicResource LoadBtn}" Style="{StaticResource HeaderButtonStyle}" Click="LoadDiagram_Click"/>
|
||||||
|
<Button Content="{DynamicResource ExportBtn}" Style="{StaticResource HeaderButtonStyle}" Click="ExportPng_Click"/>
|
||||||
|
|
||||||
|
<Rectangle Width="1" Height="24" Fill="White" Opacity="0.3" Margin="15,0"/>
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource WireBtn}" Style="{StaticResource HeaderButtonStyle}" Click="WireTool_Click"/>
|
||||||
|
<Button Content="{DynamicResource WifiBtn}" Style="{StaticResource HeaderButtonStyle}" Click="WifiTool_Click"/>
|
||||||
|
<Button Content="{DynamicResource AddTextBtn}" Style="{StaticResource HeaderButtonStyle}" Click="AddText_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||||
<ComboBox x:Name="LangCombo" VerticalAlignment="Center" Width="80" SelectionChanged="LangCombo_SelectionChanged" Margin="10,0,0,0">
|
<ComboBox x:Name="LangCombo" Width="70" Height="30" SelectionChanged="LangCombo_SelectionChanged">
|
||||||
<ComboBoxItem Tag="en" IsSelected="True">EN</ComboBoxItem>
|
<ComboBoxItem Tag="en">EN</ComboBoxItem>
|
||||||
<ComboBoxItem Tag="cs">CZ</ComboBoxItem>
|
<ComboBoxItem Tag="cs" IsSelected="True">CZ</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border Grid.Row="1" Grid.Column="0" Background="{StaticResource SidebarBlue}" BorderBrush="{StaticResource CanvasGridBlue}" BorderThickness="0,0,1,0">
|
<!-- Sidebar -->
|
||||||
<DockPanel>
|
<Border Grid.Row="1" Grid.Column="0" Background="{StaticResource LightBlue}" BorderBrush="{StaticResource GridBlue}" BorderThickness="0,0,1,0">
|
||||||
<TextBlock Text="{DynamicResource DevicesHeader}" DockPanel.Dock="Top" FontSize="16" FontWeight="SemiBold" Margin="10" Foreground="{StaticResource HeaderBlue}"/>
|
<DockPanel Margin="10,15">
|
||||||
<ListBox x:Name="ToolboxList" Background="Transparent" BorderThickness="0" Margin="5"
|
<TextBlock Text="{DynamicResource DevicesHeader}" DockPanel.Dock="Top" FontSize="18" FontWeight="Bold" Margin="10,0,10,15" Foreground="{StaticResource PrimaryBlue}"/>
|
||||||
|
<ListBox x:Name="ToolboxList" Style="{StaticResource SidebarListBoxStyle}"
|
||||||
PreviewMouseDown="Toolbox_PreviewMouseDown">
|
PreviewMouseDown="Toolbox_PreviewMouseDown">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Border BorderBrush="{StaticResource AccentBlue}" BorderThickness="1" CornerRadius="4" Margin="5" Padding="10" Background="White">
|
<Border Background="White" CornerRadius="8" Padding="12" BorderBrush="{StaticResource GridBlue}" BorderThickness="1">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="4" ShadowDepth="1" Opacity="0.05"/>
|
||||||
|
</Border.Effect>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Image Source="{Binding IconPath}" Width="32" Height="32" Margin="0,0,10,0"/>
|
<Image Source="{Binding IconPath}" Width="36" Height="36" Margin="0,0,12,0" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" FontWeight="Medium"/>
|
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="{StaticResource TextDark}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@@ -78,7 +73,8 @@
|
|||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<ScrollViewer Grid.Row="1" Grid.Column="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
<!-- Canvas Area -->
|
||||||
|
<ScrollViewer Grid.Row="1" Grid.Column="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Background="Transparent">
|
||||||
<Canvas x:Name="DiagramCanvas" Width="2000" Height="2000" AllowDrop="True"
|
<Canvas x:Name="DiagramCanvas" Width="2000" Height="2000" AllowDrop="True"
|
||||||
Drop="DiagramCanvas_Drop" DragOver="DiagramCanvas_DragOver"
|
Drop="DiagramCanvas_Drop" DragOver="DiagramCanvas_DragOver"
|
||||||
MouseDown="DiagramCanvas_MouseDown"
|
MouseDown="DiagramCanvas_MouseDown"
|
||||||
@@ -87,17 +83,17 @@
|
|||||||
<Canvas.Background>
|
<Canvas.Background>
|
||||||
<VisualBrush TileMode="Tile" Viewport="0,0,40,40" ViewportUnits="Absolute">
|
<VisualBrush TileMode="Tile" Viewport="0,0,40,40" ViewportUnits="Absolute">
|
||||||
<VisualBrush.Visual>
|
<VisualBrush.Visual>
|
||||||
<Path Data="M 0 40 L 0 0 L 40 0" Stroke="{StaticResource CanvasGridBlue}" StrokeThickness="0.5"/>
|
<Path Data="M 0 40 L 0 0 L 40 0" Stroke="{StaticResource GridBlue}" StrokeThickness="0.8"/>
|
||||||
</VisualBrush.Visual>
|
</VisualBrush.Visual>
|
||||||
</VisualBrush>
|
</VisualBrush>
|
||||||
</Canvas.Background>
|
</Canvas.Background>
|
||||||
|
|
||||||
<Canvas.Resources>
|
<Canvas.Resources>
|
||||||
<DataTemplate x:Key="DeviceTemplate">
|
<DataTemplate x:Key="DeviceTemplate">
|
||||||
<Border x:Name="DeviceBorder" BorderBrush="Transparent" BorderThickness="2" CornerRadius="4"
|
<Border x:Name="DeviceBorder" BorderBrush="Transparent" BorderThickness="2" CornerRadius="8"
|
||||||
Background="Transparent" Padding="5" MaxWidth="150">
|
Background="Transparent" Padding="8" MaxWidth="160">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Image Source="{Binding IconPath}" Width="48" Height="48" HorizontalAlignment="Center">
|
<Image Source="{Binding IconPath}" Width="56" Height="56" HorizontalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
|
||||||
<Image.Style>
|
<Image.Style>
|
||||||
<Style TargetType="Image">
|
<Style TargetType="Image">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
@@ -108,13 +104,13 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Image.Style>
|
</Image.Style>
|
||||||
</Image>
|
</Image>
|
||||||
<TextBlock Text="{Binding Name}" FontWeight="Bold" HorizontalAlignment="Center"
|
<TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="12" HorizontalAlignment="Center"
|
||||||
Foreground="#004578" TextWrapping="Wrap" TextAlignment="Center"/>
|
Foreground="{StaticResource PrimaryBlue}" TextWrapping="Wrap" TextAlignment="Center" Margin="0,4,0,0"/>
|
||||||
<ItemsControl ItemsSource="{Binding IpAddresses}">
|
<ItemsControl ItemsSource="{Binding IpAddresses}">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding}" FontSize="10" Foreground="#0078D7"
|
<TextBlock Text="{Binding}" FontSize="10" Foreground="{StaticResource AccentBlue}"
|
||||||
HorizontalAlignment="Center" TextWrapping="Wrap"/>
|
HorizontalAlignment="Center" TextWrapping="Wrap" Opacity="0.8"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
@@ -124,8 +120,8 @@
|
|||||||
</Canvas.Resources>
|
</Canvas.Resources>
|
||||||
|
|
||||||
<!-- Selection rectangle visual -->
|
<!-- Selection rectangle visual -->
|
||||||
<Rectangle x:Name="SelectionRect" Stroke="{StaticResource AccentBlue}" StrokeDashArray="2,2"
|
<Rectangle x:Name="SelectionRect" Stroke="{StaticResource AccentBlue}" StrokeThickness="1.5" StrokeDashArray="3,3"
|
||||||
Fill="#330078D7" Visibility="Collapsed" Panel.ZIndex="9999"/>
|
Fill="#220078D7" Visibility="Collapsed" Panel.ZIndex="9999" RadiusX="2" RadiusY="2" IsHitTestVisible="False"/>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -109,7 +109,11 @@ namespace NetworkDiagram
|
|||||||
{
|
{
|
||||||
var template = (DataTemplate)DiagramCanvas.Resources["DeviceTemplate"];
|
var template = (DataTemplate)DiagramCanvas.Resources["DeviceTemplate"];
|
||||||
var contentPresenter = new ContentPresenter { Content = device, ContentTemplate = template };
|
var contentPresenter = new ContentPresenter { Content = device, ContentTemplate = template };
|
||||||
var container = new Border { Child = contentPresenter, Tag = device, Background = Brushes.Transparent };
|
var container = new Border {
|
||||||
|
Child = contentPresenter,
|
||||||
|
Tag = device,
|
||||||
|
Style = (Style)Application.Current.Resources["DeviceContainerStyle"]
|
||||||
|
};
|
||||||
|
|
||||||
Canvas.SetLeft(container, device.X);
|
Canvas.SetLeft(container, device.X);
|
||||||
Canvas.SetTop(container, device.Y);
|
Canvas.SetTop(container, device.Y);
|
||||||
@@ -177,15 +181,31 @@ namespace NetworkDiagram
|
|||||||
private void SelectElement(FrameworkElement element)
|
private void SelectElement(FrameworkElement element)
|
||||||
{
|
{
|
||||||
_selectedElements.Add(element);
|
_selectedElements.Add(element);
|
||||||
element.Opacity = 0.7;
|
if (element is Border b)
|
||||||
if (element is Line l) l.StrokeThickness = 5;
|
{
|
||||||
|
b.BorderBrush = (SolidColorBrush)Application.Current.Resources["AccentBlue"];
|
||||||
|
b.Background = new SolidColorBrush(Color.FromArgb(30, 0, 120, 215)); // Light blue tint
|
||||||
|
}
|
||||||
|
else if (element is Line l)
|
||||||
|
{
|
||||||
|
l.StrokeThickness = 5;
|
||||||
|
l.Opacity = 0.8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeselectElement(FrameworkElement element)
|
private void DeselectElement(FrameworkElement element)
|
||||||
{
|
{
|
||||||
_selectedElements.Remove(element);
|
_selectedElements.Remove(element);
|
||||||
element.Opacity = 1.0;
|
if (element is Border b)
|
||||||
if (element is Line l) l.StrokeThickness = 3;
|
{
|
||||||
|
b.BorderBrush = Brushes.Transparent;
|
||||||
|
b.Background = Brushes.Transparent;
|
||||||
|
}
|
||||||
|
else if (element is Line l)
|
||||||
|
{
|
||||||
|
l.StrokeThickness = 3;
|
||||||
|
l.Opacity = 1.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearSelection()
|
private void ClearSelection()
|
||||||
|
|||||||
Reference in New Issue
Block a user