diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-02-26 16:30:42 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-02-26 16:30:42 +0200 |
| commit | 5942bb7a13e5ad26c720a1b95ae4ea766eeeda25 (patch) | |
| tree | 2a855ce1065c875e615f5b040f984cb3fb84e518 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer | |
| parent | 4c052df707280abd208b03aa88cf904e0eb6b9bf (diff) | |
| parent | 6549d8672a93893599e921d9f1938af7dcabb8bf (diff) | |
| download | Tango-5942bb7a13e5ad26c720a1b95ae4ea766eeeda25.tar.gz Tango-5942bb7a13e5ad26c720a1b95ae4ea766eeeda25.zip | |
MERGE!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
7 files changed, 128 insertions, 163 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/MillisecondsToTimeSpanConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/MillisecondsToTimeSpanConverter.cs new file mode 100644 index 000000000..70b7ce191 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/MillisecondsToTimeSpanConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class MillisecondsToTimeSpanConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + return TimeSpan.FromMilliseconds(System.Convert.ToInt32(value)); + } + else + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Resources/GraphEx.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Resources/GraphEx.xaml deleted file mode 100644 index a44a8191c..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Resources/GraphEx.xaml +++ /dev/null @@ -1,126 +0,0 @@ -<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:sys="clr-namespace:System;assembly=mscorlib" - xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Resources"> - - <FontFamily x:Key="FontName">Segoe UI</FontFamily> - <FontFamily x:Key="NotesFont">Lucida Console</FontFamily> - - <sys:Double x:Key="ExtraExtraLargeFontSize">28</sys:Double> - <sys:Double x:Key="ExtraLargeFontSize">26</sys:Double> - <sys:Double x:Key="LargeFontSize">20</sys:Double> - <sys:Double x:Key="MediumFontSize">16</sys:Double> - <sys:Double x:Key="SmallFontSize">14</sys:Double> - <sys:Double x:Key="MiniFontSize">12</sys:Double> - <sys:Double x:Key="TinyFontSize">9</sys:Double> - - <!--Colors--> - <Color x:Key="borderColor">Silver</Color> - <Color x:Key="graphGridLinesColor">#FFE9E9E9</Color> - <Color x:Key="graphsMarkerColor">Gray</Color> - <Color x:Key="materialColor">#03A9F4</Color> - - - <!--Brushes--> - <SolidColorBrush x:Key="borderBrush" Color="{StaticResource borderColor}"></SolidColorBrush> - <SolidColorBrush x:Key="graphGridLinesBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> - <SolidColorBrush x:Key="BlackBrush" Color="#545454"></SolidColorBrush> - - <SolidColorBrush x:Key="graphGridLinesLightBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> - <SolidColorBrush x:Key="graphGridLinesDarkBrush" Color="#FF2E2E2E"></SolidColorBrush> - - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundLight"> - <GradientStop Color="White"/> - <GradientStop Color="#FFE9E9E9" Offset="1"/> - </LinearGradientBrush> - - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundDark"> - <GradientStop Color="Black"/> - <GradientStop Color="#FF333333" Offset="1"/> - </LinearGradientBrush> - - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackground"> - <GradientStop Color="White"/> - <GradientStop Color="#FFE9E9E9" Offset="1"/> - </LinearGradientBrush> - - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphLabelBackground" Opacity="0.7"> - <GradientStop Color="White"/> - <GradientStop Color="#FFD9D9D9" Offset="1"/> - </LinearGradientBrush> - - <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphLegendBackground" Opacity="0.7"> - <GradientStop Color="#FFE9E9E9"/> - <GradientStop Color="#FFBDBDBD" Offset="1"/> - </LinearGradientBrush> - - <SolidColorBrush Color="#FFF1F1F1" x:Key="topBarBackgroundBrush"></SolidColorBrush> - - <!--Navigation Link Button--> - <Style x:Key="LinkButton" TargetType="Button"> - <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <TextBlock FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}"> - <ContentPresenter /></TextBlock> - </ControlTemplate> - </Setter.Value> - </Setter> - <Setter Property="Foreground" Value="{StaticResource BlackBrush}" /> - <Style.Triggers> - <Trigger Property="IsEnabled" Value="False"> - <Setter Property="Opacity" Value="0.5"></Setter> - </Trigger> - <Trigger Property="IsMouseOver" Value="true"> - <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> - </Trigger> - <EventTrigger RoutedEvent="TouchUp"> - <BeginStoryboard> - <Storyboard> - <ColorAnimation Storyboard.TargetProperty="Foreground.Color" Duration="0" To="{StaticResource BlackColor}"></ColorAnimation> - </Storyboard> - </BeginStoryboard> - </EventTrigger> - </Style.Triggers> - </Style> - <!--Navigation Link Button--> - - - <!--Graph Label--> - <Style x:Key="graphLabel" TargetType="Label"> - <Style.Setters> - <Setter Property="IsHitTestVisible" Value="False"></Setter> - <Setter Property="Margin" Value="-1 -1 0 0"></Setter> - <Setter Property="HorizontalAlignment" Value="Left"></Setter> - <Setter Property="VerticalAlignment" Value="Top"></Setter> - <Setter Property="Padding" Value="0"></Setter> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <Border Width="Auto" Padding="0 0 20 0" Height="25" BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1" CornerRadius="0 0 30 0" Background="{StaticResource graphLabelBackground}" > - <TextBlock Margin="5 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TinyFontSize}" Text="{Binding}"></TextBlock> - </Border> - </DataTemplate> - </Setter.Value> - </Setter> - </Style.Setters> - </Style> - <!--Graph Label--> - - - <!--Graph Ticks Template--> - <DataTemplate x:Key="graphTicksTemplate"> - <Ellipse Width="3" Height="3" Margin="0 0 0 0" Fill="{StaticResource AccentColorBrush}"></Ellipse> - </DataTemplate> - <!--Graph Ticks Template--> - - <DataTemplate x:Key="graphTooltipTemplate"> - <Border CornerRadius="5" BorderThickness="1" BorderBrush="White" Padding="8" MinWidth="50" Margin="20 0 20 0"> - <Border.Background> - <SolidColorBrush Color="Black" Opacity="0.5"></SolidColorBrush> - </Border.Background> - <TextBlock Foreground="White" FontSize="10" HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding StringFormat='0.000'}"></TextBlock> - </Border> - </DataTemplate> -</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 364b8573a..2d20b789c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -108,6 +108,7 @@ <Compile Include="Converters\InkVolumeToLiquidRmlFactor.cs" /> <Compile Include="Converters\JobProgressToPositionConverter.cs" /> <Compile Include="Converters\JobToColumnDefinitionsConverter.cs" /> + <Compile Include="Converters\MillisecondsToTimeSpanConverter.cs" /> <Compile Include="Converters\ObjectsNotEqualToBooleanConveter.cs" /> <Compile Include="Converters\OneToPercentConverter.cs" /> <Compile Include="Converters\SegmentLengthToWidthConverter.cs" /> @@ -136,10 +137,6 @@ <Compile Include="Views\RunningJobView.xaml.cs"> <DependentUpon>RunningJobView.xaml</DependentUpon> </Compile> - <Page Include="Resources\GraphEx.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> <Page Include="Views\MainView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index cf66efbd6..b9ef26e9b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1165,6 +1165,7 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log(String.Format("Saving the active job {0}...", ActiveJob.Name)); ActiveJob.LastUpdated = DateTime.UtcNow; ActiveJob.Rml = SelectedRML; + ActiveJob.EstimatedDurationMili = (int)EstimatedDuration.TotalMilliseconds; await ActiveJob.SaveAsync(_activeJobDbContext); ReloadMachine(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 4467b1f28..e9867d202 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -34,6 +34,13 @@ <Setter Property="Margin" Value="2" /> </Style> + <ResourceDictionary x:Key="SelectAllTextBoxResource"> + <Style TargetType="TextBox"> + <EventSetter Event="GotFocus" Handler="TextBox_GotFocus"></EventSetter> + <EventSetter Event="MouseDown" Handler="TextBox_PreviewMouseUp"></EventSetter> + </Style> + </ResourceDictionary> + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> @@ -59,6 +66,7 @@ <localConverters:OneToPercentConverter x:Key="OneToPercentConverter"/> <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> + <converters:IsNotConverter x:Key="IsNotConverter" /> <ObjectDataProvider x:Key="dispenserDivisions" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> @@ -474,7 +482,7 @@ </Grid> - + </StackPanel> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Margin="0 40 40 0"> @@ -617,13 +625,13 @@ </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> - <ContentControl Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> <ContentControl.Foreground> <SolidColorBrush Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> </ContentControl.Foreground> - <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.0" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> <mahapps:NumericUpDown.Resources> - <Style TargetType="TextBox"/> + <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> </mahapps:NumericUpDown.Resources> </mahapps:NumericUpDown> </ContentControl> @@ -969,6 +977,16 @@ <DataTrigger Binding="{Binding DispenserStepDivision}" Value="{x:Static dispensing:DispenserStepDivisions.Auto}"> <Setter Property="Content" Value="Auto"></Setter> </DataTrigger> + <DataTrigger Binding="{Binding DispenserStepDivision,Converter={StaticResource IsNotConverter},ConverterParameter={x:Static dispensing:DispenserStepDivisions.Auto}}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <TextBlock> + <Run Text="{Binding PulsePerSecond,Mode=OneWay,StringFormat='0.0'}"></Run> + <Run Text="(pulse)" FontSize="9" Foreground="Gray"></Run> + </TextBlock> + </Setter.Value> + </Setter> + </DataTrigger> </Style.Triggers> </Style> </Label.Style> @@ -1217,7 +1235,7 @@ <TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox> <WrapPanel Orientation="Vertical" Margin="0 5 0 0"> <WrapPanel.Resources> - <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}"> + <Style TargetType="TextBlock"> <Setter Property="FontSize" Value="10"></Setter> <Setter Property="Foreground" Value="#7A7A7A"></Setter> <Setter Property="Margin" Value="0 5 0 5"></Setter> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs index 27ea3cae8..470d98912 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs @@ -1,4 +1,5 @@ -using System; +using MahApps.Metro.Controls; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -89,7 +90,7 @@ namespace Tango.MachineStudio.Developer.Views private void UpdateGradientBrushDisplay() { - if (_vm.SelectedSegment != null) + if (_vm != null && _vm.SelectedSegment != null) { SegmentToGradientStopsConverter converter = new SegmentToGradientStopsConverter(); GradientStopCollection stops = converter.Convert(_vm.SelectedSegment, null, null, null) as GradientStopCollection; @@ -97,7 +98,10 @@ namespace Tango.MachineStudio.Developer.Views } else { - gradientBrush.GradientStops = new GradientStopCollection(); + if (gradientBrush != null) + { + gradientBrush.GradientStops = new GradientStopCollection(); + } } } @@ -133,5 +137,18 @@ namespace Tango.MachineStudio.Developer.Views { _vm.OnDropSegment(e.Draggable.DataContext as Segment, e.Droppable.DataContext as Segment); } + + + private async void TextBox_GotFocus(object sender, RoutedEventArgs e) + { + await Task.Delay(200); + TextBox txtBox = sender as TextBox; + txtBox.SelectAll(); + } + + private void TextBox_PreviewMouseUp(object sender, MouseButtonEventArgs e) + { + e.Handled = true; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml index fcb730de7..1ddff2696 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -19,6 +19,9 @@ <UserControl.Resources> <localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" /> <converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter"/> + <localConverters:MillisecondsToTimeSpanConverter x:Key="MillisecondsToTimeSpanConverter" /> + <converters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter" /> + <converters:MathOperatorConverter x:Key="MathOperatorConverter" /> </UserControl.Resources> <Grid> @@ -80,7 +83,7 @@ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0"> <materialDesign:PackIcon Kind="Magnify" Width="26" Height="26"/> - <TextBox Width="300" materialDesign:HintAssist.Hint="Search" Text="{Binding JobFilter,UpdateSourceTrigger=PropertyChanged}"></TextBox> + <TextBox Width="300" materialDesign:HintAssist.Hint="Search name, user, length..." Text="{Binding JobFilter,UpdateSourceTrigger=PropertyChanged}"></TextBox> </StackPanel> </Grid> @@ -139,21 +142,21 @@ </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <DataGridTemplateColumn Header="CREATION DATE" Width="170" CanUserSort="True" SortMemberPath="CreationDate"> + <DataGridTemplateColumn Header="CREATION DATE" Width="150" CanUserSort="True" SortMemberPath="CreationDate"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding CreationDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" FontSize="14"></TextBlock> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <DataGridTemplateColumn Header="LAST MODIFIED" Width="170" CanUserSort="True" SortMemberPath="LastUpdated"> + <DataGridTemplateColumn Header="LAST MODIFIED" Width="150" CanUserSort="True" SortMemberPath="LastUpdated"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" FontSize="14"></TextBlock> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <DataGridTemplateColumn Header="LAST RUN" Width="170" CanUserSort="True" SortMemberPath="LastRun"> + <DataGridTemplateColumn Header="LAST RUN" Width="150" CanUserSort="True" SortMemberPath="LastRun"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding LastRun,Converter={StaticResource DateTimeUTCToShortDateTimeConverter},FallbackValue='Never',TargetNullValue='Never'}" VerticalAlignment="Center" FontSize="14"></TextBlock> @@ -177,29 +180,54 @@ </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> - <DataGridTemplateColumn Width="1*"> + <DataGridTemplateColumn Header="DURATION" Width="100" CanUserSort="True" SortMemberPath="EstimatedDurationMili"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <ItemsControl HorizontalAlignment="Right" ItemsSource="{Binding Segments}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> - - </StackPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <Border Width="25" Height="25" Margin="10 0 0 0" BorderThickness="1" BorderBrush="DimGray" CornerRadius="3"> - <Border.Background> - <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> - <Binding Path="."></Binding> - </MultiBinding> - </Border.Background> - </Border> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + <TextBlock VerticalAlignment="Center" FontSize="14"> + <Run Text="{Binding EstimatedDurationMili,Converter={StaticResource MillisecondsToTimeSpanConverter},Mode=OneWay,StringFormat=hh\\:mm\\:ss,TargetNullValue='Unknown'}"></Run> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Width="1*" Header="SEGMENTS" CanUserSort="True" SortMemberPath="Segments.Count"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <ItemsControl HorizontalAlignment="Right" ItemsSource="{Binding Segments}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" MaxWidth="110"> + + </StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border Width="25" Height="25" Margin="10 0 0 0" BorderThickness="1" BorderBrush="DimGray" CornerRadius="3"> + <Border.Background> + <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> + <Binding Path="."></Binding> + </MultiBinding> + </Border.Background> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <StackPanel Orientation="Horizontal" Margin="0 0 0 0" VerticalAlignment="Center"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Segments.Count,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=3}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <materialDesign:PackIcon Kind="Plus" Width="18" Height="18" VerticalAlignment="Center" /> + <TextBlock Margin="0 -3 0 0" Text="{Binding Segments.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-3'}" FontSize="16" VerticalAlignment="Center" FontWeight="SemiBold" FontStyle="Italic"></TextBlock> + </StackPanel> + </StackPanel> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> |
