wpf controls - WPF and AutoRedraw -


i have custom wpf line , style. usercontrol resources:

    <!-- framework properties update -->     <solidcolorbrush x:key="mylinebrush" color="lightgreen" />     <sys:double x:key="mylinestrokethickness">1</sys:double>      <!-- custom property update -->     <sys:boolean x:key="mylineisarrowused">false</sys:boolean>       <style targettype="local:myline" x:key="mylinestylekey">          <!-- autoupdates control -->         <setter property="fill"                  value="{dynamicresource mylinebrush}"/>         <setter property="strokethickness"                  value="{dynamicresource mylinestrokethickness}" />          <!-- not autoupdate control -->         <setter property="showtext"                  value="{dynamicresource mylineisarrowused}"/> 

now, observed when update mylinestrokethickness control updated instantly. when update custom dependency property mylineisarrowused there no changes.

what should use in order update custom control (line) drawing once custom dependency property updated?

i tried:

static void onisarrowusedchanged(dependencyobject source, dependencypropertychangedeventargs e) {     var s = (myline)source;     s.updatelayout();             } 

but not work.

the control updates when move or other actions when forced redraw itself.

in dependency property declaration add frameworkpropertymetadata.affectsmeasure

http://msdn.microsoft.com/en-us/library/system.windows.frameworkpropertymetadata.affectsmeasure.aspx


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -