resize - Showing only part of Canvas in WPF C# -
i have canvas in wpf project defined 1000 x 3000px.
now i'm using clip method point (0,1000) (1000, 2000). middle of canvas. want show in scrollviewer, there problem - have lot of space before , after clipped part. how align clipped canvas top?
more specific: canvas contain 3 pages (1000x1000px), want clip middle page , operate on it. in project want show 1 page @ top op scrollviewer. after clipping correct part of canvas, spaces before , after.
how it? maybe need use method instead of clip?
or maybe else? example split canvas after every 1000px.. in word :)
here's solution came with. have replace canvas yours.
<window x:class="stackoverflow.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:stackoverflow" title="mainwindow" height="350" width="525"> <window.resources> <local:allnonecheckboxconverter x:key="converter"/> <local:valuepointconverter x:key="vpconverter"/> </window.resources> <grid> <scrollviewer verticalscrollbarvisibility="hidden" horizontalscrollbarvisibility="visible" width="1000" height="1000" > <canvas width="3000" height="1000"> <canvas.background> <lineargradientbrush startpoint="0,0" endpoint="1,1"> <gradientstop color="red" offset="0.3"/> <gradientstop color="blue" offset="0.6"/> <gradientstop color="black" offset="1"/> </lineargradientbrush> </canvas.background> </canvas> </scrollviewer> </grid> </window>
Comments
Post a Comment