Two bugs

9 posts, 1 answers
  1. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 26 Nov 2008 Link to this post

    I think I've found two bugs. They're both illustrated with screenshots in the powerpoint file (link below). Let me know if you need more info. /Henrik

    http://cid-cc43a90a79374ebd.skydrive.live.com/self.aspx/Public/RadMenu|_Bugs.zip


  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 26 Nov 2008 Link to this post

    Hi Henrik,

    I've created RadWindow and added RadMenu inside (from the link) but I'm not sure if this is the correct case.
    I did notice one bug (due to the change that UserControl no longer clip its content) and fixed it. But I was unable to reproduce the bugs that you reported.
    Could you send me a sample project so I get investigate it further?

    Thanks and sorry for the troubles.


    Best wishes,
    Hristo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 26 Nov 2008 Link to this post

    Here's a sample project. Just click the arrow in the top right corner to trigger the bug.

    http://cid-cc43a90a79374ebd.skydrive.live.com/self.aspx/Public/RadMenuBug|_SampleProject.zip
  4. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 27 Nov 2008 Link to this post

    Hello Henrik,

    Silverlight 2 is a great platform but it has some bugs. One of them is the bug where you are not allowed to call TransformToVisual method from an element that is not in the main visual tree. Now this is a real problem especially for RadWindow because the window is not in the main visual tree. RadWindow is displayed in Popup control and the visual tree of the popup is not connected with the main visual tree (the main visual tree is the tree from Application.Current.RootVisual). So in order to be able to call TransformToVisual from RadWindow and its content we need to attach the window popup to the main visual tree. But to be able to do it we need Application.Current.RootVisual to be created.
    The general recommendation is to open RadWindow after the Page Loaded event has been fired.

    So in your case if you move window opening in loaded event - everything should be working fine.
    I am sorry for the inconvenience but until Microsoft fix this bug we cannot offer better solution.


    Best wishes,
    Hristo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 27 Nov 2008 Link to this post

    This was confusing at first, until I realised that the bug in the sample project is completely unrelated to my original bugs. In fact, in my real application I'm not opening the windows in the constructor, I'm doing it in Button.OnClick. Here's a new sample project that demonstrates the second of the bugs in the powerpoint file. To trigger the bug, do the following:
    1. Click the button to open the window
    2. Click the top menu button to open the menu
    3. Close the window
    4. Repeat steps 1-3 and the menu will be empty.
    5. Repeat steps 1-3 again and the app will crash.

    http://cid-cc43a90a79374ebd.skydrive.live.com/self.aspx/Public/RadMenuBugs|_SampleProject02.zip
  6. Answer
    Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 27 Nov 2008 Link to this post

    Hi Henrik,

    In the sample you provided I saw that there was an error at step 4.
    The error stated that an item with the same x:Name already existed.

    It appears that you cannot set x:Name attribute on ItemsControl that show its items in the Popup control (and the same ItemsControl is in popup). For example, if you modify your project to use ComboBox instead of RadMenu and Popup control instead of RadWindow (and one more button to close the popup), you will experience the same behavior. I tried to find workarounds but with no success.

    So the only solution I can suggest at the moment is that you remove the x:Name attributes.


    Kind regards,
    Hristo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 27 Nov 2008 Link to this post

    Ah, I see. I guess I'll just hook up the event handlers in xaml instead and get rid of the names. Thanks.

    Regarding the other bug (where the menu makes it first appearance half way outside the browser window) I've so far been unable to reproduce it outside my "real" application (which I can't send you due to a number of reasons).  I'm guessing it has something to do with the container that the window resides in. I'll investigate it further when I get the time, but as long as we're rid of the crashes it isn't too big a deal.

    Best regards, /Henrik
  8. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 28 Nov 2008 Link to this post

    Hi Henrik,

    May I suggest using the routed events to catch the menuitem click event. Here is a sample code:

    using System.Windows;  
    using System.Windows.Controls;  
    using Telerik.Windows;  
    using Telerik.Windows.Controls;  
     
    namespace SilverlightDockingDemo  
    {  
        public partial class Page5 : UserControl  
        {  
            public Page5()  
            {  
                InitializeComponent();  
                this.AddHandler(RadMenuItem.ClickEvent, new RoutedEventHandler(OnMenuItemClick));  
            }  
     
            private void OnMenuItemClick(object sender, RoutedEventArgs args)  
            {  
                RadRoutedEventArgs e = args as RadRoutedEventArgs;  
                RadMenuItem menuItem = e.OriginalSource as RadMenuItem;  
                // Do something base on menuItem.Header property  
            }  
        }  

    This way you don't need the x:Name attribute and there is no need to attach handler to all RadMenuItems Click event separately. The only thing is to attach handler to element that is visual parent of all menuItems (for example RadMenu, RadContextMenu or Page5 in this code).

    The cast from RoutedEventArgs to RadRoutedEventArgs is needed because the OriginalSource property is readonly. We will probably change the delegate type for the next major release.

    If you need more information, I'll be glad to help.


    Sincerely yours,
    Hristo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 03 Dec 2008 Link to this post

    You're right, that's much better.
Back to Top