Skip to content

Commit

Permalink
Ensures Border BorderBrush and Background loading with the right colors.
Browse files Browse the repository at this point in the history
  • Loading branch information
BDisp committed Aug 25, 2023
1 parent 2a779ed commit 8a7a5b1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Design.cs
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,26 @@ private IEnumerable<Property> LoadDesignableProperties()
}
}

private Color GetBorderBorderBrush()
{
if (this.View.Border.BorderBrush == (Color)(-1) && this.View.Border.Parent.ColorScheme != null)
{
return this.View.Border.Parent.ColorScheme.Normal.Foreground;
}

return this.View.Border.BorderBrush;
}

private Color GetBorderBackground()
{
if (this.View.Border.Background == (Color)(-1) && this.View.Border.Parent.ColorScheme != null)
{
return this.View.Border.Parent.ColorScheme.Normal.Background;
}

return this.View.Border.Background;
}

private bool ShowTextProperty()
{
// never show Text for root because it's almost certainly a container
Expand All @@ -796,6 +816,16 @@ private bool ShowTextProperty()

private Property CreateSubProperty(string name, string subObjectName, object subObject)
{
if (name == "BorderBrush")
{
this.View.Border.BorderBrush = this.GetBorderBorderBrush();
}

if (name == "Background")
{
this.View.Border.Background = this.GetBorderBackground();
}

return new Property(
this,
subObject.GetType().GetProperty(name) ?? throw new Exception($"Could not find expected Property '{name}' on Sub Object of Type '{subObject.GetType()}'"),
Expand Down

0 comments on commit 8a7a5b1

Please sign in to comment.