Silverlight is completely buggy with canvas

╄→гoц情女王★ 提交于 2019-12-24 10:15:17

问题


It's incredible that such sample code doesn't even work.

I have put this inside grid but I can't see any line (code taken from MSDN in fact):

    <Canvas Height="103" HorizontalAlignment="Left" Margin="30,166,0,0" Name="canvas1" VerticalAlignment="Top" Width="180">
        <Line
X1="0" Y1="10"
X2="5" Y2="10"
Stroke="Black"
StrokeThickness="4" />
    </Canvas>

This is incredible that such simple thing like that would be so buggy so did I miss something see picture below ? (Everything else in silverlight works fine for me):

Update: the bug is confirmed. This is quite incredible that MS hasn't fixed this !


回答1:


It does appear. Your line is a very small dot with 5pixel width. Try changing the coordinates to draw a longer line.




回答2:


Others have confirmed with latest version of Silverlight this doesn't work except OUTSIDE OF CANVAS ! So indeed this is a huge bug.




回答3:


I've faced exactly with that and here is my solution:

<Canvas Height="103" Width="180" HorizontalAlignment="Left" Margin="30,166,0,0" Name="canvas1" VerticalAlignment="Top" >
    <Line Height="103" Width="180" X1="0" Y1="10" X2="5" Y2="10" Stroke="Black" StrokeThickness="4" />
</Canvas>

Thus, you must set to same size with Line and Canvas. Actually, Line placing to where you put but it isn't showing cause hasn't size.



来源:https://stackoverflow.com/questions/5800252/silverlight-is-completely-buggy-with-canvas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!