开发者

How to add border of canvas

I want to add the border off canvas us开发者_JAVA技巧ing C# not XAML

How can i achieve it?


I think you're better off by placing the canvas inside a border, then specify the border thickness in your code-behind. In your code you could then programmatically turn the border on and off.

XAML:

<Border x:Name="CanvasBorder" BorderBrush="Black">
    <Canvas>
        <!--Items here-->
    </Canvas>
</Border>

Code-behind:

// Turn on border
CanvasBorder.BorderThickness = new Thickness(1);

// Turn off border
CanvasBorder.BorderThickness = new Thickness(0);


You can simple create border canvas with DataBinding on her Width to MainCanvas.ActualWidth and Height to MainCanvas.ActualHeight

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜