fix<Launcher>: INotifyPropertyChanged event not raised when IsActive changed

This commit is contained in:
leo 2020-12-07 18:37:24 +08:00
parent a2254ae578
commit d993147107
2 changed files with 18 additions and 4 deletions

View file

@ -79,7 +79,7 @@
</DataTemplate>
<DataTemplate DataType="{x:Type local:Launcher+RepoTab}">
<Grid MinWidth="72" Margin="12,0">
<Grid MinWidth="80" Margin="8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>

View file

@ -21,18 +21,32 @@ namespace SourceGit.UI {
/// Tab data.
/// </summary>
public class Tab : INotifyPropertyChanged {
private bool isActive = false;
public string Title { get; set; }
public string Tooltip { get; set; }
public bool IsActive { get; set; }
public Git.Repository Repo { get; set; }
public object Page { get; set; }
public bool IsRepo => Repo != null;
public bool IsRepo {
get { return Repo != null; }
}
public int Color {
get { return Repo == null ? 0 : Repo.Color; }
set {
if (Repo == null || Repo.Color == value) return;
Repo.Color = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Color"));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Color"));
}
}
public bool IsActive {
get { return isActive; }
set {
if (isActive == value) return;
isActive = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsActive"));
}
}