Surface rearranging WIP

This commit is contained in:
SpoinkyNL committed 2019-08-24 23:24:13 +02:00
1 parent a35774eeb4
commit 171f63a1db
24 files changed
+308 -648

No files matched your search

@@ -1,33 +0,0 @@
<UserControl x:Class="Artemis.UI.Views.Controls.Editor.SurfaceEditorView"
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:editor="clr-namespace:Artemis.UI.ViewModels.Controls.Editor"
xmlns:xaml="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
d:DataContext="{d:DesignInstance editor:SurfaceEditorViewModel}">
<StackPanel>
<TextBlock>Surface editor view</TextBlock>
<ItemsControl ItemsSource="{Binding Devices}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="Canvas.Left" Value="{Binding Device.Location.X}" />
<Setter Property="Canvas.Top" Value="{Binding Device.Location.Y}" />
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Width="{Binding Device.Size.Width}" Height="{Binding Device.Size.Height}" xaml:View.Model="{Binding }"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</UserControl>
@@ -7,9 +7,11 @@
xmlns:xaml="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance rgbDevice:RgbDeviceViewModel}"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800"
Cursor="{Binding Cursor}">
<UserControl.Resources></UserControl.Resources>
<Grid>
<Image Source="{Binding Device.DeviceInfo.Image}"></Image>
<Image Source="{Binding Device.DeviceInfo.Image}" />
<ItemsControl ItemsSource="{Binding Leds}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -24,9 +26,50 @@
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Width="{Binding Width}" Height="{Binding Height}" xaml:View.Model="{Binding}" ToolTip="{Binding Tooltip}" />
<ContentControl Width="{Binding Width}" Height="{Binding Height}" xaml:View.Model="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Rectangle Width="Auto" Height="Auto" StrokeThickness="1">
<Rectangle.Style>
<Style TargetType="Rectangle">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectionStatus}" Value="{x:Static rgbDevice:SelectionStatus.Hover}">
<Setter Property="Rectangle.Fill">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource IdealForegroundColor}" Opacity="0.25" />
</Setter.Value>
</Setter>
<Setter Property="Rectangle.Stroke" Value="{DynamicResource IdealForegroundColorBrush}"/>
</DataTrigger>
<DataTrigger Binding="{Binding SelectionStatus}" Value="{x:Static rgbDevice:SelectionStatus.Selected}">
<Setter Property="Rectangle.Fill">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource Primary400}" Opacity="0.25" />
</Setter.Value>
</Setter>
<Setter Property="Rectangle.Stroke" Value="{DynamicResource PrimaryHueLightBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding SelectionStatus}" Value="{x:Static rgbDevice:SelectionStatus.None}">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.25" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.25" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</Grid>
</UserControl>
@@ -6,18 +6,20 @@
xmlns:rgbDevice="clr-namespace:Artemis.UI.ViewModels.Controls.RgbDevice"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance rgbDevice:RgbLedViewModel}"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="25" d:DesignWidth="25"
ToolTip="{Binding Tooltip}"
ToolTipService.IsEnabled="{Binding ColorsEnabled}">
<Grid Width="{Binding Width}" Height="{Binding Height}">
<Grid.Background>
<ImageBrush AlignmentX="Center" AlignmentY="Center" Stretch="Fill" ImageSource="{Binding Led.Image}" />
</Grid.Background>
<Path Data="{Binding DisplayGeometry}" ClipToBounds="False">
<Path Data="{Binding DisplayGeometry}" ClipToBounds="False" Visibility="{Binding ColorsEnabled, Converter={StaticResource BoolToVisibilityConverter}}">
<Path.Fill>
<SolidColorBrush Color="{Binding DisplayColor}" Opacity="0.25" />
</Path.Fill>
</Path>
<Path Data="{Binding StrokeGeometry}" ClipToBounds="False">
<Path Data="{Binding StrokeGeometry}" ClipToBounds="False" Visibility="{Binding ColorsEnabled, Converter={StaticResource BoolToVisibilityConverter}}">
<Path.Fill>
<SolidColorBrush Color="{Binding DisplayColor}" />
</Path.Fill>