Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Did you get this issue? Canvas width problem? RSS

28 replies

Last post May 20, 2011 10:08 AM by notacat

(0)
  • bacnt

    bacnt

    Member

    1 Points

    34 Posts

    Did you get this issue? Canvas width problem?

    Dec 29, 2008 08:15 AM | LINK

     Here is my example:

     

    <UserControl x:Class="DrawSilverlight.Page"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Width="800" Height="500"  xmlns:local="clr-namespace:DrawSilverlight">
        <Canvas Width="800" Height="500" Background="White">
            <ScrollViewer x:Name="scrvTest" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled" Height="400" Width="800">
                <Canvas x:Name="cnvTest" Background="Gold" Height="400" Canvas.Left="0" Canvas.Top="0" Width="300000"></Canvas>
            </ScrollViewer>
        </Canvas>
    </UserControl>

     You see, I set canvas cnvTest width is 300000 pixels (very large) but I don't know why when I set cnvTest is more than 32762 the cnvTest is seem to be cut into some parts and it's not solid like normal? It made me two days to try but result is zero.

    Did you get this ? Help me please!

    In my situation, canvas width would be very large :(

    Thank in advanced!

    Best Rgds

    Nong Tien Bac
    A Newbie :P
  • bryant

    bryant

    Star

    10113 Points

    1662 Posts

    Re: Did you get this issue? Canvas width problem?

    Dec 29, 2008 06:45 PM | LINK

    What do you mean

    bacnt

    is seem to be cut into some parts and it's not solid like normal?
    ?

     

    -- bryant

    Blog | Twitter
    _________________
    Dont forget to click "Mark as Answer" on the post that helped you.
  • bacnt

    bacnt

    Member

    1 Points

    34 Posts

    Re: Did you get this issue? Canvas width problem?

    Dec 30, 2008 03:30 AM | LINK

     Like my previous post, I said that when I set cnvTest width > 32762. It will be shown like below: whole wrong

     

     

     

     

     

     

    Nong Tien Bac
    A Newbie :P
  • SteveWong

    SteveWong

    Contributor

    6769 Points

    1351 Posts

    Re: Re: Did you get this issue? Canvas width problem?

    Dec 30, 2008 05:31 AM | LINK

    I do think it is a bug

    Regards,
    SteveWong (HongKong)
    Please mark post as answer if they help you
  • vinCracker

    vinCracker

    Contributor

    4059 Points

    673 Posts

    Re: Re: Did you get this issue? Canvas width problem?

    Dec 30, 2008 10:41 AM | LINK

    Yes, I can also reproduce it. But when I see control in blend it show no error while in running mode(in browser) I got this behavior. I also searched about the maximum width/height a control can have but seems no documentation about that. Also found many wired behavior when changed height to the width ratio. Not sure about what cause this.

  • bryant

    bryant

    Star

    10113 Points

    1662 Posts

    Re: Re: Did you get this issue? Canvas width problem?

    Dec 30, 2008 08:12 PM | LINK

    I think you'd be better off trying to figure out another way to do what you want without having a canvas that is so large. Why do you need such a large canvas?

    -- bryant

    Blog | Twitter
    _________________
    Dont forget to click "Mark as Answer" on the post that helped you.
  • bacnt

    bacnt

    Member

    1 Points

    34 Posts

    Re: Re: Did you get this issue? Canvas width problem?

    Dec 31, 2008 02:23 AM | LINK

     Yes, I have to. My canvas would be so large. Imagine, first time my canvas width is about 200px and it contains 1 Rectangle (width 5px). when I choose that Rectangle and click FIT -> line will be increased and certainly canvas width would be increased too. Do you know Timeline application? I view Month and it shows ok, but when I click one Timeslot in Month and click FIT (Zoom width) my canvas will be increased and width of it is about morethan 100000 pixels [:(] I don't know what is the cause here? Is there any solution, microsoft huh? It would be fixed in Silverlight 3? And when will Silverlight 3 to be released? [:'(]

    Nong Tien Bac
    A Newbie :P
  • Amanda Wang - MSFT

    Amanda Wang...

    All-Star

    17236 Points

    1466 Posts

    Re: Re: Did you get this issue? Canvas width problem?

    Jan 05, 2009 01:39 AM | LINK

     

     Hi bacnt,

    Thanks for reporting this.  We have known this issue and we have been tracking this issue, now.
    Amanda Wang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • bacnt

    bacnt

    Member

    1 Points

    34 Posts

    Re: Re: Did you get this issue? Canvas width problem?

    Jan 05, 2009 02:08 AM | LINK

    Thanks for your reply, I hope it will be fixed as soon as possible. I know the Silverlight is a new one and subject to containing many issues. Hope hope and hope!!!

    Nong Tien Bac
    A Newbie :P
  • Olav Haga

    Olav Haga

    Member

    6 Points

    15 Posts

    Re: Re: Did you get this issue? Canvas width problem?

    Jan 05, 2009 05:38 AM | LINK

    I had the same problem.

     My solution is to create a white canvas with the large width. (Think my max was 42000)

    I needed a 15 pixel higy grey field at the buttom on the canvas. This had to be done in a loop. I don't remember the limits, but say that you can write a rectangle with 1000 pixels with and the fill it you can do that 42 times and your problem is solved. Rectangle and Line has the same limits in with. The limit is more than 1000. This worked fine, the problem was performance. So my solution now is to just draw the canvas that is showed. Need to draw again each time the user scroll.