0

I have some WPF code binding a block to a color as follows:

    <GeometryDrawing>
        <GeometryDrawing.Brush>
            <LinearGradientBrush>
                <LinearGradientBrush.GradientStops>
                    <GradientStop Offset="0.00" Color="{Binding Path=Element.Color}"/>
                    <GradientStop Offset="1.00" Color="{Binding Path=Element.Color}"/>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
        </GeometryDrawing.Brush>
    </GeometryDrawing>

Now I want to bind the border (or Pen property) to another field, such as Element.BorderColor. How should that be done?

Thanks

daniely
  • 7,313
  • 5
  • 29
  • 46

1 Answers1

0

You can use the ElementName binding to bind to properties in other UI elements in your window

<GradientStop Offset="0.00" Color="{Binding ElementName=MyElement Path=TheColor}"/>
sa_ddam213
  • 42,848
  • 7
  • 101
  • 110