Skip to content

Commit

Permalink
design
Browse files Browse the repository at this point in the history
  • Loading branch information
msarilar committed Apr 7, 2018
1 parent 69cf912 commit 083d24d
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 97 deletions.
20 changes: 14 additions & 6 deletions EDEngineer/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@
<converters:IntOrNullConverter x:Key="IntOrNull" />
<converters:IntegerToVisibilityConverterReversed x:Key="IntegerToVisibilityReversed" />
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibility" />
<converters:KindToVisibility x:Key="KindToVisibility" />
<converters:KindToVisibility x:Key="UnknownKindToVisible"
SpecialKind="Unknown"
Inclusive="True"/>
<converters:KindToVisibility x:Key="CommodityKindToCollapsed"
SpecialKind="Commodity"
Inclusive="False"/>
<converters:OriginToControlTemplateConverter x:Key="OriginToControlTemplate" />
<converters:OriginToColorConverter x:Key="OriginToColor" />
<converters:BooleanToOpacityConverter x:Key="BooleanToOpacity" />
Expand Down Expand Up @@ -822,12 +827,13 @@
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Tag" Value="{StaticResource AccentBackgroundBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid Background="{StaticResource AccentBackgroundBrush}"
<Grid Background="{TemplateBinding Tag}"
SnapsToDevicePixels="False">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3"/>
Expand All @@ -837,7 +843,7 @@
<iconPacks:PackIconMaterial RenderTransformOrigin="0.5, 0.5" Grid.Column="1" x:Name="icon" Kind="ChevronRight" VerticalAlignment="Center" HorizontalAlignment="Center">
<iconPacks:PackIconMaterial.RenderTransform>
<TransformGroup>
<RotateTransform x:Name="rtAngle" Angle="90"/>
<RotateTransform x:Name="rtAngle" Angle="0"/>
</TransformGroup>
</iconPacks:PackIconMaterial.RenderTransform>
</iconPacks:PackIconMaterial>
Expand Down Expand Up @@ -877,11 +883,12 @@
<Style x:Key="GroupExpander"
TargetType="Expander">
<Setter Property="Foreground" Value="OrangeRed"/>
<Setter Property="Tag" Value="{StaticResource AccentBackgroundBrush}"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Grid Background="{StaticResource AccentBackgroundBrush}"
<Grid Background="{TemplateBinding Tag}"
Margin="0"
Width="{Binding
RelativeSource={RelativeSource
Expand Down Expand Up @@ -919,6 +926,7 @@
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Margin="1" MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}"
Tag="{TemplateBinding Tag}"
Style="{StaticResource ExpanderDownHeaderStyle}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
<ContentPresenter x:Name="ExpandSite"
Expand All @@ -929,7 +937,7 @@
Visibility="Visible"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter.LayoutTransform>
<ScaleTransform x:Name="contentScale" ScaleY="1"/>
<ScaleTransform x:Name="contentScale" ScaleY="0"/>
</ContentPresenter.LayoutTransform>
</ContentPresenter>
</DockPanel>
Expand Down
5 changes: 4 additions & 1 deletion EDEngineer/Converters/KindToVisibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
{
var kind = (Kind) value;

return kind == Kind.Unknown ? Visibility.Visible : Visibility.Collapsed;
return Inclusive == (kind == SpecialKind) ? Visibility.Visible : Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

public Kind SpecialKind { get; set; }
public bool Inclusive { get; set; }
}
}
3 changes: 2 additions & 1 deletion EDEngineer/Views/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ public void RefreshCargoSources()
commander.Filters.Monitor(blueprintSource, commander.State.Cargo.Ingredients.Select(c => c.Value), commander.HighlightedEntryData);
Blueprints.ItemsSource = blueprintSource.View;

Materials.ItemsSource = commander.FilterView(viewModel, Kind.Material | Kind.Commodity, new CollectionViewSource { Source = commander.State.Cargo.Ingredients });
Materials.ItemsSource = commander.FilterView(viewModel, Kind.Material, new CollectionViewSource { Source = commander.State.Cargo.Ingredients });
Data.ItemsSource = commander.FilterView(viewModel, Kind.Data, new CollectionViewSource { Source = commander.State.Cargo.Ingredients });
Commodities.ItemsSource = commander.FilterView(viewModel, Kind.Commodity, new CollectionViewSource { Source = commander.State.Cargo.Ingredients });
}

private void PostLoad(WindowDimensions dimensions)
Expand Down
Loading

0 comments on commit 083d24d

Please sign in to comment.