Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VDG] Fix TreeDataGridPrivacyTextCell rendering #12510

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ internal class TreeDataGridPrivacyTextCell : TreeDataGridCell
private int _numberOfPrivacyChars;
private string? _privacyText;
private Size? _availableSize;
private bool _haveText;

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
Expand All @@ -46,6 +47,7 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
if (_text != text)
{
_text = text;
_haveText = !string.IsNullOrWhiteSpace(_text);
_privacyText = new string('#', _numberOfPrivacyChars);
_formattedText = null;

Expand All @@ -68,6 +70,11 @@ public override void Render(DrawingContext context)
{
context.FillRectangle(Brushes.Transparent, new Rect(new Point(), DesiredSize));

if (!_haveText)
{
return;
}

var formattedText = _isContentVisible ? _formattedText : _privacyFormattedText;

if (formattedText is not null)
Expand Down