mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-30 00:24:59 +00:00
ux: use dynamic icon for filter tips.
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
44557c066c
commit
1298a22b00
10 changed files with 42 additions and 11 deletions
|
@ -574,9 +574,13 @@
|
|||
</Border.IsVisible>
|
||||
|
||||
<Grid Height="28" ColumnDefinitions="Auto,*,Auto">
|
||||
<TextBlock Grid.Column="0" Margin="8,0,0,0" Classes="table_header" Text="{DynamicResource Text.Repository.FilterCommits.Prefix}"/>
|
||||
|
||||
<ItemsControl Grid.Column="1" Margin="8,0,0,0" ItemsSource="{Binding Settings.HistoriesFilters}">
|
||||
<Path Grid.Column="0"
|
||||
x:Name="HistoriesFilterModeIcon"
|
||||
Margin="8,0,0,0"
|
||||
Width="14" Height="14"
|
||||
Fill="{DynamicResource Brush.FG2}"/>
|
||||
|
||||
<ItemsControl Grid.Column="1" Margin="8,0,0,0" ItemsSource="{Binding Settings.HistoriesFilters}" LayoutUpdated="OnHistoriesFiltersLayoutUpdated">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
|
||||
|
|
|
@ -395,5 +395,40 @@ namespace SourceGit.Views
|
|||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnHistoriesFiltersLayoutUpdated(object sender, EventArgs e)
|
||||
{
|
||||
var repo = DataContext as ViewModels.Repository;
|
||||
if (repo == null)
|
||||
return;
|
||||
|
||||
var filters = repo.Settings.HistoriesFilters;
|
||||
if (filters.Count == 0)
|
||||
return;
|
||||
|
||||
var mode = filters[0].Mode;
|
||||
if (mode == _lastFilterMode)
|
||||
return;
|
||||
|
||||
_lastFilterMode = mode;
|
||||
|
||||
var icon = null as StreamGeometry;
|
||||
switch (mode)
|
||||
{
|
||||
case Models.FilterMode.Included:
|
||||
icon = this.FindResource("Icons.Filter") as StreamGeometry;
|
||||
break;
|
||||
case Models.FilterMode.Excluded:
|
||||
icon = this.FindResource("Icons.EyeClose") as StreamGeometry;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (icon != null)
|
||||
HistoriesFilterModeIcon.Data = icon;
|
||||
}
|
||||
|
||||
private Models.FilterMode _lastFilterMode = Models.FilterMode.None;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue