Cannot get visual appearance of a UserControl to change

RogerSchlueter-7899 1,281 Reputation points
2021-02-21T13:55:28.447+00:00

I use a UserControl called Dot to draw circles on a map:

<UserControl
    x:Class="Dot"
    .....
    <Ellipse
        Fill="{Binding Path=FillColor}"
        Height="{Binding Path=Diameter}"
        Width="{Binding Path=Diameter}">
    </Ellipse>
</UserControl>

This is how I draw it:

Private Sub DrawPoint(Colr As SolidColorBrush, Radius As Double)
    ADot = New Dot With {.FillColor = Colr, .Diameter = 2 * Radius}
    MapLayr.AddChild(ADot, PointLocation, PositionOrigin.Center)
End Sub

Initially the colr is Red. After validation I want to change the color to green using:

ADot.FillColor = Brushes.Green

That does not change the appearance of the dot on the map. What more needs to be done to actually change the visible color?

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,714 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 116.6K Reputation points
    2021-02-21T15:03:06.43+00:00

    Probably FillColor is a simple property, but it must be defined as a Dependency Property (https://video2.skills-academy.com/en-us/dotnet/desktop/wpf/advanced/dependency-properties-overview) to support binding. Show some details about FillColor.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.