mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-25 14:15:00 +00:00
ux: new style for current branch (#998)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
3d4a9b86b4
commit
5d2cd8b2fa
3 changed files with 18 additions and 19 deletions
|
@ -57,18 +57,11 @@
|
|||
IsExpanded="{Binding IsExpanded}"/>
|
||||
|
||||
<!-- Name -->
|
||||
<Grid Grid.Column="1" ColumnDefinitions="Auto,*">
|
||||
<Border Grid.Column="0" Margin="0,0,4,0" Background="Green" Height="16" CornerRadius="8" VerticalAlignment="Center" IsVisible="{Binding IsCurrent}">
|
||||
<TextBlock Text="HEAD" Classes="primary" Margin="8,0" Foreground="#FFDDDDDD" FontSize="10" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Classes="primary"
|
||||
Text="{Binding Name}"
|
||||
FontWeight="{Binding IsCurrent, Converter={x:Static c:BoolConverters.IsBoldToFontWeight}}"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Column="1"
|
||||
Classes="primary"
|
||||
Text="{Binding Name}"
|
||||
FontWeight="{Binding IsCurrent, Converter={x:Static c:BoolConverters.IsBoldToFontWeight}}"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
|
||||
<!-- Tracking status -->
|
||||
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"
|
||||
|
|
|
@ -52,31 +52,31 @@ namespace SourceGit.Views
|
|||
|
||||
if (node.Backend is Models.Remote)
|
||||
{
|
||||
CreateContent(new Thickness(0, 0, 0, 0), "Icons.Remote");
|
||||
CreateContent(new Thickness(0, 0, 0, 0), "Icons.Remote", false);
|
||||
}
|
||||
else if (node.Backend is Models.Branch branch)
|
||||
{
|
||||
if (branch.IsCurrent)
|
||||
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Check");
|
||||
CreateContent(new Thickness(0, 0, 0, 0), "Icons.CheckCircled", true);
|
||||
else
|
||||
CreateContent(new Thickness(2, 0, 0, 0), "Icons.Branch");
|
||||
CreateContent(new Thickness(2, 0, 0, 0), "Icons.Branch", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node.IsExpanded)
|
||||
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder.Open");
|
||||
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder.Open", false);
|
||||
else
|
||||
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder");
|
||||
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder", false);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateContent(Thickness margin, string iconKey)
|
||||
private void CreateContent(Thickness margin, string iconKey, bool highlight)
|
||||
{
|
||||
var geo = this.FindResource(iconKey) as StreamGeometry;
|
||||
if (geo == null)
|
||||
return;
|
||||
|
||||
Content = new Path()
|
||||
var path = new Path()
|
||||
{
|
||||
Width = 12,
|
||||
Height = 12,
|
||||
|
@ -85,6 +85,11 @@ namespace SourceGit.Views
|
|||
Margin = margin,
|
||||
Data = geo,
|
||||
};
|
||||
|
||||
if (highlight)
|
||||
path.Fill = Brushes.Green;
|
||||
|
||||
Content = path;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue