mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-23 01:36:57 -08:00
fix: SelectableTextBlock
does not re-draw after Text
property changed (#906)
This commit is contained in:
parent
c8aecc00cc
commit
1c8d4d312a
2 changed files with 32 additions and 12 deletions
|
@ -20,13 +20,13 @@
|
||||||
<StackPanel Grid.Column="1" Margin="16,0,8,0" Orientation="Vertical">
|
<StackPanel Grid.Column="1" Margin="16,0,8,0" Orientation="Vertical">
|
||||||
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.CommitDetail.Info.Author}"/>
|
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.CommitDetail.Info.Author}"/>
|
||||||
<Grid Margin="0,10,0,8" ColumnDefinitions="Auto,*" ClipToBounds="True">
|
<Grid Margin="0,10,0,8" ColumnDefinitions="Auto,*" ClipToBounds="True">
|
||||||
<SelectableTextBlock Grid.Column="0" Text="{Binding Author.Name}" Margin="2,0,8,0"/>
|
<v:EnhancedSelectableTextBlock Grid.Column="0" Text="{Binding Author.Name}" Margin="2,0,8,0"/>
|
||||||
<SelectableTextBlock Grid.Column="1" Text="{Binding Author.Email}" ToolTip.Tip="{Binding Author.Email}" Foreground="{DynamicResource Brush.FG2}" TextTrimming="CharacterEllipsis"/>
|
<v:EnhancedSelectableTextBlock Grid.Column="1" Text="{Binding Author.Email}" ToolTip.Tip="{Binding Author.Email}" Foreground="{DynamicResource Brush.FG2}" TextTrimming="CharacterEllipsis"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<SelectableTextBlock Text="{Binding AuthorTimeStr}"
|
<v:EnhancedSelectableTextBlock Text="{Binding AuthorTimeStr}"
|
||||||
Margin="2,0,0,0"
|
Margin="2,0,0,0"
|
||||||
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Decrease}}"
|
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Decrease}}"
|
||||||
Foreground="{DynamicResource Brush.FG2}"/>
|
Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
@ -36,13 +36,13 @@
|
||||||
<StackPanel Grid.Column="1" Margin="16,0,8,0" Orientation="Vertical">
|
<StackPanel Grid.Column="1" Margin="16,0,8,0" Orientation="Vertical">
|
||||||
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.CommitDetail.Info.Committer}"/>
|
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.CommitDetail.Info.Committer}"/>
|
||||||
<Grid Margin="0,10,0,8" ColumnDefinitions="Auto,*" ClipToBounds="True">
|
<Grid Margin="0,10,0,8" ColumnDefinitions="Auto,*" ClipToBounds="True">
|
||||||
<SelectableTextBlock Grid.Column="0" Text="{Binding Committer.Name}" Margin="2,0,8,0"/>
|
<v:EnhancedSelectableTextBlock Grid.Column="0" Text="{Binding Committer.Name}" Margin="2,0,8,0"/>
|
||||||
<SelectableTextBlock Grid.Column="1" Text="{Binding Committer.Email}" ToolTip.Tip="{Binding Committer.Email}" Foreground="{DynamicResource Brush.FG2}" TextTrimming="CharacterEllipsis"/>
|
<v:EnhancedSelectableTextBlock Grid.Column="1" Text="{Binding Committer.Email}" ToolTip.Tip="{Binding Committer.Email}" Foreground="{DynamicResource Brush.FG2}" TextTrimming="CharacterEllipsis"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<SelectableTextBlock Text="{Binding CommitterTimeStr}"
|
<v:EnhancedSelectableTextBlock Text="{Binding CommitterTimeStr}"
|
||||||
Margin="2,0,0,0"
|
Margin="2,0,0,0"
|
||||||
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Decrease}}"
|
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Decrease}}"
|
||||||
Foreground="{DynamicResource Brush.FG2}"/>
|
Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
|
|
20
src/Views/EnhancedSelectableTextBlock.cs
Normal file
20
src/Views/EnhancedSelectableTextBlock.cs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace SourceGit.Views
|
||||||
|
{
|
||||||
|
public class EnhancedSelectableTextBlock : SelectableTextBlock
|
||||||
|
{
|
||||||
|
protected override Type StyleKeyOverride => typeof(SelectableTextBlock);
|
||||||
|
|
||||||
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||||
|
{
|
||||||
|
base.OnPropertyChanged(change);
|
||||||
|
|
||||||
|
if (change.Property == TextProperty)
|
||||||
|
UpdateLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue