locked
Silverlight Carousel like menu control RRS feed

  • Question

  • Hi.

    I am working on creating a Carousel like menu control in Silverlight 2.0 similar to the one in the link http://www.mydotnetplayground.nl/menu/default.aspx  except that I want sub menus also to be displayed in the form of carousel.

    To accomplish this first I added following code in page.xaml:

    <Grid x:Name="LayoutRoot" >

    <Canvas x:Name="MyCanvas" />

    <Canvas x:Name="MySubCanvas" />

    </Grid>

    Then I created a new control SubImageControl similar to ImageControl. On the mouse image_MouseLeftButtonDown in ImageControl.cs, I want to populate all the sub menus for selected menu.

    Now the challange is that when I add following line of code in ImageControl.cs

    void image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {

    var img = new SubImageControl();Page page = this.Parent as Page;

    page.MySubCanvas.Children.Add(img);

    HtmlPage.Window.Navigate(new Uri(NavigateUrl, UriKind.RelativeOrAbsolute));

    }

     this.Parent returns null. As page.xaml is adding control ImageControl within it, I must be having a way to get the instance of page in ImageControl. But that doesn't appear to happen. 

    If some has any information or suggestions please let me know.

    Also if someone happen to know any such type of Carousel Menu Control (third party is fine), please let me know. 

    Sunday, November 9, 2008 1:47 PM

Answers

  • Thank you so much. But its still using Beta and asking me to uninstall the silverlight 2.0 and install the 2.0 beta 2 version.

     I found a way to get into the parent page.. here is the code.

    Canvas canvas = this.Parent as Canvas;

    Grid grid = canvas.Parent as Grid; Page page = grid.Parent as Page;

    page.MySubCanvas.Children.Add(sImage);

    Sunday, November 9, 2008 3:29 PM

All replies