Change field viewer

This commit is contained in:
Evgeny Redikultsev
2025-12-13 20:13:45 +05:00
parent 681ab17781
commit f937b9f373
31 changed files with 730 additions and 246 deletions

View File

@@ -24,19 +24,29 @@
<Button x:Name="ZoomOutButton" Content="ZoomOut" Command="{Binding ZoomOutCommand}"/>
<Button x:Name="ChangeColorMapButton" Content="ColorMap" Command="{Binding ChangeColorMapCommand}"/>
</StackPanel>
<ScrollViewer Name="WorkPlaneViewer" Grid.Row="1" HorizontalScrollBarVisibility="Visible" SizeChanged="WorkPlaneViewer_SizeChanged">
<ScrollViewer.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black"/>
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="#FF00EDFF" Offset="0"/>
</LinearGradientBrush>
</ScrollViewer.Background>
<Viewbox Name="WorkPlaneBox" Margin="10">
<Canvas Name="WorkPlaneCanvas">
</Canvas>
</Viewbox>
</ScrollViewer>
<Grid Grid.Row="1">
<StackPanel Panel.ZIndex="1">
<TextBlock Text="{Binding Title}" FontWeight="Bold"/>
<TextBlock Text="{Binding SubTitle}"/>
</StackPanel>
<ScrollViewer Name="WorkPlaneViewer" HorizontalScrollBarVisibility="Visible" SizeChanged="WorkPlaneViewer_SizeChanged">
<ScrollViewer.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black"/>
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="#FF00EDFF" Offset="0"/>
</LinearGradientBrush>
</ScrollViewer.Background>
<Viewbox Name="WorkPlaneBox" Margin="10">
<Grid>
<Canvas x:Name="LabelCanvas"/>
<Canvas x:Name="WorkPlaneCanvas">
</Canvas>
</Grid>
</Viewbox>
</ScrollViewer>
</Grid>
</Grid>
<ScrollViewer Grid.Column="2">
<StackPanel>

View File

@@ -0,0 +1,27 @@
<UserControl x:Class="FieldVisualizer.Windows.UserControls.ValueLabelControl"
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:FieldVisualizer.Windows.UserControls"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="100"
Name="ThisControl">
<Grid DataContext="{Binding ElementName=ThisControl}">
<Canvas>
<Canvas.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding Scale}" ScaleY="{Binding Scale}"/>
<TranslateTransform X="{Binding X}" Y="{Binding Y}"/>
</TransformGroup>
</Canvas.RenderTransform>
<Path Data="M 0 0 l 20 -25 v 16 z" Fill="AntiqueWhite"/>
<Canvas>
<Canvas.RenderTransform>
<TranslateTransform X="20" Y="-25"/>
</Canvas.RenderTransform>
<TextBlock MinWidth="25" Text="{Binding Value}" Background="AntiqueWhite"/>
</Canvas>
</Canvas>
</Grid>
</UserControl>

View File

@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace FieldVisualizer.Windows.UserControls
{
/// <summary>
/// Interaction logic for ValueLabelControl.xaml
/// </summary>
public partial class ValueLabelControl : UserControl
{
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register(nameof(Value), typeof(string), typeof(ValueLabelControl), new PropertyMetadata("Label value"));
public double X
{
get { return (double)GetValue(XProperty); }
set { SetValue(XProperty, value); }
}
// Using a DependencyProperty as the backing store for X. This enables animation, styling, binding, etc...
public static readonly DependencyProperty XProperty =
DependencyProperty.Register(nameof(X), typeof(double), typeof(ValueLabelControl), new PropertyMetadata(0.0));
public double Y
{
get { return (double)GetValue(YProperty); }
set { SetValue(YProperty, value); }
}
// Using a DependencyProperty as the backing store for Y. This enables animation, styling, binding, etc...
public static readonly DependencyProperty YProperty =
DependencyProperty.Register(nameof(Y), typeof(double), typeof(ValueLabelControl), new PropertyMetadata(0.0));
public double Scale
{
get { return (double)GetValue(ScaleProperty); }
set { SetValue(ScaleProperty, value); }
}
// Using a DependencyProperty as the backing store for Scale. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ScaleProperty =
DependencyProperty.Register(nameof(Scale), typeof(double), typeof(ValueLabelControl), new PropertyMetadata(0.0));
public ValueLabelControl()
{
InitializeComponent();
}
}
}