Tuesday, 15 July 2014

c# - WPF change color of Rectangle Fill in code -



c# - WPF change color of Rectangle Fill in code -

hey new @ wpf's , in need of changing color of rectangle fill in wpf.

currently have this:

<rectangle fill="{binding acolor}" radiusy="5" radiusx="5"> <rectangle.effect> <dropshadoweffect shadowdepth="0"/> </rectangle.effect> </rectangle>

i not sure how go using binding above within code.

any help great!

fill property of type brush , cant bind color directly,

do this,

<rectangle width="100" height="100"> <rectangle.fill> <solidcolorbrush color="{binding color}"/> </rectangle.fill> </rectangle>

otherway can implement color-to-brush converter. this

c# wpf binding

No comments:

Post a Comment