wpf histogram fidelity degrades when resized smaller -


i've developed simple histogram control shows distribution of grayscale colors (1 256 bins) in live image. control renders rectangles in itemscontrol itemscontainer viewbox. working fine part, when resize grid column (using gridsplitter) hosting control fidelity of histogram begins degrade.

here's couple shots of histogram @ initial state, , when has been resized horizontally (notice dark vertical lines in forest of green rectangles...it gets worse smaller go):

enter image description here enter image description here

here's xaml renders histogram:

  <itemscontrol x:name="_histogram" margin="1,3"                   itemssource="{binding histogramcollection}"                  verticalalignment="bottom">       <itemscontrol.template>           <controltemplate targettype="itemscontrol">               <grid>                   <viewbox stretch="fill" maxheight="100" >                       <itemspresenter />                   </viewbox>               </grid>           </controltemplate>       </itemscontrol.template>        <itemscontrol.itemspanel>           <itemspaneltemplate>               <stackpanel orientation="horizontal" />           </itemspaneltemplate>       </itemscontrol.itemspanel>        <itemscontrol.itemtemplate>           <datatemplate>               <grid>                   <rectangle fill="limegreen"                              stretch="fill"                              height="{binding bin}"                              minwidth="1"                              strokethickness="0"                              verticalalignment="bottom"                              horizontalalignment="stretch"                              renderoptions.edgemode="aliased"                              uselayoutrounding="true"                              mouseenter="rectangle_mouseenter"                              mouseleave="rectangle_mouseleave"                             />               </grid>           </datatemplate>       </itemscontrol.itemtemplate>   </itemscontrol> 

any thoughts? guess wpf throwing out visuals in order evenly distribute rest.

i've experimented using polygon in lieu of itemscontrol , rectangles distribute bin points , behavior goes away, however, need ability mouseover histogram , show popup (among other things, e.g. select range of bins , update properties in viewmodel). if know of way, using polygon approach, can hover in green area , determine i'm on specific bin i'm open that.

update:

removing renderoptions.edgemode="aliased" on rectangle xaml seems solve problem of black line glitches. though render pale in designer (using d:designdata), seems render fine @ runtime. i'm going hold off on marking "answered" until others have had chance chime in. i'm interested in polygon approach because crisper histogram when resizing larger width (the wider make histogram, more pixelated peaks get, i.e. peaks flat because of width of rectangle, presents jagged plot instead of smooth curved plot). if point had mouse on handler :d.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -