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); } 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() { public Bookmark() {
icon = new Path(); icon = new Path();
Child = icon; Child = icon;
@ -57,11 +49,6 @@ namespace SourceGit.Views.Controls {
var mark = d as Bookmark; var mark = d as Bookmark;
if (mark == null) return; if (mark == null) return;
if (mark.HideOnZero && mark.Color == 0) {
mark.Visibility = Visibility.Collapsed;
return;
}
if (!mark.IsNewPage) { if (!mark.IsNewPage) {
if (mark.Color == 0) { if (mark.Color == 0) {
mark.icon.SetResourceReference(Path.FillProperty, "Brush.FG1"); mark.icon.SetResourceReference(Path.FillProperty, "Brush.FG1");
@ -74,8 +61,6 @@ namespace SourceGit.Views.Controls {
mark.icon.SetResourceReference(Path.FillProperty, "Brush.FG1"); mark.icon.SetResourceReference(Path.FillProperty, "Brush.FG1");
mark.icon.Data = mark.FindResource("Icon.WelcomePage") as Geometry; mark.icon.Data = mark.FindResource("Icon.WelcomePage") as Geometry;
} }
mark.Visibility = Visibility.Visible;
} }
} }
} }

View file

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

View file

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