c# - image integration in setter -
i have used path create custom object as:
<path style="{staticresource abc_style}" tooltip="object abc" horizontalalignment="center" verticalalignment="center"></path>
abc_style definition is:
<style x:key="abc_style" targettype="path"> <setter ..../> <setter property="fill" value .../> </style>
now, have assign mesh image object (as content).
questions:
- is there way integrate image it?
- if so, possible avoid picture getting stretched?
thanks.
what can think is, can create drawing brush
<imagebrush imagesource="image.jpg" x:key="imagebrush" /> <drawingbrush x:key="thatchbackground" viewport="0,0,50,50" viewportunits="absolute" stretch="none" tilemode="tile"> <drawingbrush.drawing> <geometrydrawing brush="{staticresource imagebrush}"> <geometrydrawing.geometry> <geometrygroup> <rectanglegeometry rect="0,0,50,50"/> </geometrygroup> </geometrydrawing.geometry> </geometrydrawing> </drawingbrush.drawing> </drawingbrush>
and set path fill below
<path fill="{staticresource thatchbackground}">
i got tutorial http://wpfplayground.blogspot.com/2011/09/texture-background-in-wpf.html
Comments
Post a Comment