style<Welcome>: fix wrong icon displayed for group folder in repositories manager

This commit is contained in:
leo 2021-08-18 09:34:07 +08:00
parent c1a4ecee46
commit 232c209079
3 changed files with 10 additions and 37 deletions

View file

@ -39,14 +39,6 @@ namespace SourceGit.Views.Controls {
set { SetValue(IsNewPageProperty, value); }
}
public static readonly DependencyProperty HideOnZeroProperty =
DependencyProperty.Register("HideOnZero", typeof(bool), typeof(Bookmark), new PropertyMetadata(false, UpdateBookmark));
public bool HideOnZero {
get { return (bool)GetValue(HideOnZeroProperty); }
set { SetValue(HideOnZeroProperty, value); }
}
public Bookmark() {
icon = new Path();
Child = icon;
@ -57,11 +49,6 @@ namespace SourceGit.Views.Controls {
var mark = d as Bookmark;
if (mark == null) return;
if (mark.HideOnZero && mark.Color == 0) {
mark.Visibility = Visibility.Collapsed;
return;
}
if (!mark.IsNewPage) {
if (mark.Color == 0) {
mark.icon.SetResourceReference(Path.FillProperty, "Brush.FG1");
@ -74,8 +61,6 @@ namespace SourceGit.Views.Controls {
mark.icon.SetResourceReference(Path.FillProperty, "Brush.FG1");
mark.icon.Data = mark.FindResource("Icon.WelcomePage") as Geometry;
}
mark.Visibility = Visibility.Visible;
}
}
}

View file

@ -58,8 +58,7 @@
<controls:Bookmark
Width="14" Height="14"
IsNewPage="{Binding IsWelcomePage}"
Color="{Binding Bookmark}"
HideOnZero="False"/>
Color="{Binding Bookmark}"/>
<TextBlock
Grid.Column="1"

View file

@ -125,7 +125,7 @@
<ColumnDefinition Width="22"/>
</Grid.ColumnDefinitions>
<Path Grid.Column="0" Margin="2,0,0,0" x:Name="Icon" Width="16" Height="16" Data="{StaticResource Icon.Git}"/>
<Path Grid.Column="0" Margin="2,0,0,0" x:Name="Icon" Width="16" Height="16" Data="{StaticResource Icon.Folder.Fill}"/>
<controls:Bookmark
Grid.Column="0"
@ -133,9 +133,7 @@
x:Name="BookmarkIcon"
Width="16" Height="16"
Color="{Binding Bookmark}"
IsNewPage="False"
HideOnZero="False"
Visibility="Collapsed"/>
IsNewPage="False"/>
<StackPanel Grid.Column="1" x:Name="Contents" Orientation="Horizontal">
<TextBlock Margin="8,0" Text="{Binding Name}"/>
@ -154,32 +152,23 @@
LostFocus="RenameEnd"
IsHitTestVisible="True"
Visibility="Collapsed"/>
</Grid>
</Border>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding IsGroup}" Value="True">
<Setter TargetName="Path" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="Icon" Property="Visibility" Value="Visible"/>
<Setter TargetName="BookmarkIcon" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsGroup}" Value="False">
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed"></Setter>
<Setter TargetName="BookmarkIcon" Property="Visibility" Value="Visible"></Setter>
<Setter TargetName="Path" Property="Visibility" Value="Visible"/>
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="BookmarkIcon" Property="Visibility" Value="Visible"/>
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsGroup}" Value="True"/>
<Condition Binding="{Binding IsExpanded}" Value="False"/>
</MultiDataTrigger.Conditions>
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Fill}"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsGroup}" Value="True"/>
<Condition Binding="{Binding IsExpanded}" Value="True"/>
</MultiDataTrigger.Conditions>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}, Path=IsExpanded}" Value="True">
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
</MultiDataTrigger>
</DataTrigger>
<DataTrigger Binding="{Binding IsEditing}" Value="True">
<Setter TargetName="Editor" Property="Visibility" Value="Visible"/>
<Setter TargetName="Contents" Property="Visibility" Value="Collapsed"/>