This is a migrated thread and some comments may be shown as answers.

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

4 Answers 71 Views
TileView
This is a migrated thread and some comments may be shown as answers.
hayfa
Top achievements
Rank 1
hayfa asked on 01 Dec 2010, 06:39 PM
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>

4 Answers, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 02 Dec 2010, 03:23 PM
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
0
hayfa
Top achievements
Rank 1
answered on 02 Dec 2010, 04:09 PM
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
0
hayfa
Top achievements
Rank 1
answered on 02 Dec 2010, 05:32 PM
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
0
Zarko
Telerik team
answered on 06 Dec 2010, 06:35 PM
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
Tags
TileView
Asked by
hayfa
Top achievements
Rank 1
Answers by
Zarko
Telerik team
hayfa
Top achievements
Rank 1
Share this question
or