Setting .TileState from another page

5 posts, 1 answers
  1. Hakki
    Hakki avatar
    47 posts
    Member since:
    Sep 2012

    Posted 27 Sep 2012 Link to this post

    Hello,

    I have a navbar on the MainFrame.xaml. I have a TileView on the WelcomeScreen.xaml.

    The navbar has a Setup button that when clicked I want to maximise a tile in the tileview of WelcomeScreen.

    I have tried this method which invoked the Messagebox successfully but did not change the tile size:

    MainFrame.xaml.cs
    private void SetupButton_Click(object sender, RoutedEventArgs e)
           {
               var wc = new WelcomeScreen();
               wc.MaximiseSetup();
           }

    WelcomeScreen.xaml.cs
    public void MaximiseSetup()
            {
                //successfully triggers
                MessageBox.Show("Test");
     
                //this doesn't
                SetupTile.TileState = TileViewItemState.Maximized;
            }


    Thanks for any help,
    Hakki
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 01 Oct 2012 Link to this post

    Hello Hakki Sahinkaya,

    I`m not sure I understand your scenario correctly. Are you using a ChildWindow, a UserControl or a Page to represent the WelcomeScreen? Also, can you please elaborate more on where you've placed the WelcomeScreen and when the SetupTile is initialized?

    I tried to reproduce the issue in the attached project. Can you please change it in order to demonstrate better your scenario? This way we will be able to investigate what causes the issue?

    All the best,
    TeamX2_Pavel
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  3. DevCraft banner
  4. Hakki
    Hakki avatar
    47 posts
    Member since:
    Sep 2012

    Posted 02 Oct 2012 Link to this post

    Hello,

    Thanks for the reply. Here is a project I bashed out real quick duplicating exactly what I'm trying to do. When user clicks the Setup button, that Setup tile should maximise.

    https://www.dropbox.com/s/ewtw3584qt8ss05/Telerik%20-%20TileViewMaximiseProblem.zip

    As you can see the method to maximise calls the test messabox, but won't maximise tile. I am guessing there is a bad mix of controls/ page etc I am using there.

    Anywho, thanks for taking a look and of any ideas to resolve the issue.
  5. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 03 Oct 2012 Link to this post

    Hello Hakki,

    I will go straight to your issue. This code works as expected:

    var wc = new WelcomeScreen();
    wc.MaximiseSetup();

    However, please note that this way a new WelcomeScreen is created and a tile in it is maximized. The point is that the newly created WelcomeScreen is not shown in the MainPage.

    Instead, I think you want to maximize the tile on the WelcomeScreen instance that already exists on your MainPage. In order to do this you have to access it. This can be done by replacing your code with the following:

    if (ContentFrame.Content is WelcomeScreen)
    {
        (ContentFrame.Content as WelcomeScreen).MaximiseSetup();
    }

    For your convenience I implemented the above the changes in the attached project.

    Greetings,
    TeamX2_Pavel
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Hakki
    Hakki avatar
    47 posts
    Member since:
    Sep 2012

    Posted 05 Oct 2012 Link to this post

    That did it, thanks.
Back to Top
DevCraft banner