How to navigate between pages in the same large content When button clicked

5 posts, 0 answers
  1. hayfa
    hayfa avatar
    3 posts
    Member since:
    Oct 2010

    Posted 01 Dec 2010 Link to this post

    Hello

    I'm using a radTileView Component as described bellow:

    in the small and normal content, i have one page to display by RadTileViewItem

    but in the large RadTileViewItem, at a first time, it loads a page which displays
    -  data concerning MyObject,
    -  a button "Create New Object", when clicked, the same large content must load another different page containing a form to create MyObject.

    How can I bind the button click in a page to open another page in the same RadTileViewItem?

    and thank you


    <!--Large Content-->
    <telerik:RadFluidContentControl.LargeContent>
        <FenetreDeplacee:LargeContentAlerte  VerticalAlignment="Stretch"  
    HorizontalAlignment="Stretch"/>   <!-- this one contains a button to load another page-->
    </telerik:RadFluidContentControl.LargeContent>

  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 02 Dec 2010 Link to this post

    Hello hayfa,

     You can simply change the LargeContent of the FluidContentControl on button click like this:

    RadTileViewItem tile = (e.OriginalSource as Button).ParentOfType<RadTileViewItem>();
                if (tile != null && tile.TileState == TileViewItemState.Maximized)
                {
                    RadFluidContentControl fluidControl = tile.ChildrenOfType<RadFluidContentControl>().FirstOrDefault();
                    if (fluidControl != null)
                    {
                        StackPanel sp = new StackPanel();
                        sp.Children.Add(new TextBox());
                        sp.Children.Add(new Button(){Content = "Create"});
                        fluidControl.LargeContent = sp;
                    }
                }

     

    Greetings,
    Zarko
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. hayfa
    hayfa avatar
    3 posts
    Member since:
    Oct 2010

    Posted 02 Dec 2010 Link to this post

    This is what i need, thank you

    I find another way but it was too long, the right way is to use this: "(e.OriginalSource as Button)" 
    thank you for your help and for your prompt reply
  5. hayfa
    hayfa avatar
    3 posts
    Member since:
    Oct 2010

    Posted 02 Dec 2010 Link to this post

    It works for a first time but then it didn't. I think it was a problem of project built. It was my version which ran.

    This is my solution and it is what i need:

    private void RadTileView_TileStateChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
          {
              RadTileViewItem item = e.Source as RadTileViewItem;
     
              if (item != null)
              {
                  contentControlAlerte = item.FindChildByType<RadFluidContentControl>();
                  if (contentControlAlerte != null)
                  {
                      switch (item.TileState)
                      {
                          case TileViewItemState.Maximized:
                              contentControlAlerte.State = FluidContentControlState.Large;
                              break;
                          case TileViewItemState.Minimized:
                              contentControlAlerte.State = FluidContentControlState.Small;
                              break;
                          case TileViewItemState.Restored:
                              contentControlAlerte.State = FluidContentControlState.Normal;
                              break;
                      }
                  }
     
                  if (item.Name.Equals("My_Alerts"))
                  {
                      LargeContentAlerte LargeContentAlerte = new LargeContentAlerte();
                      contentControlAlerte.LargeContent = LargeContentAlerte;
                      Button btn = LargeContentAlerte.ChildrenOfType<Button>().Where(button => button.Name == "CreateAlerte").FirstOrDefault();
     
                      btn.Click += new RoutedEventHandler(btn_Click);
                  }
              }
          }
     
          void btn_Click(object sender, System.Windows.RoutedEventArgs e)
          {
              CreateNewAlerte CreateAlerte = new CreateNewAlerte();
     
              contentControlAlerte.LargeContent = CreateAlerte;
          }

    Perhaps there is another way, more straight :)

    Thank you anyway
  6. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 06 Dec 2010 Link to this post

    Hello hayfa,

     Could you please examine the attached project and see if this is what you're looking for?

    Regards,
    Zarko
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top
DevCraft banner