Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
Can I call a xaml page in TilePane
posted

Hi,

I am adding the TilePanes dynamically on the XamTileView. Is there a way to call other xaml pages as content in each of these tilePanes? If so, how?

Thanks,

Harish

Parents
  • 445
    posted

    Hello,

    I got navigation sorted out. I am trying to load various xaml pages into each of the TilePane I create dynamically. However I am running to a couple of issues.

    Here is the XAML template I have

        <UserControl.Resources>
            <DataTemplate x:Key="UserTemplate">
                <Image Stretch="Uniform" MaxWidth="100" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </DataTemplate>
            <DataTemplate x:Key="UserTemplateMaximized">
                <StackPanel Loaded="StackMax_Loaded">
                   <navigation:Frame x:Name="navFrame" Margin="0"/>
                </StackPanel>
            </DataTemplate>
            <DataTemplate x:Key="UserTemplateMinimized">           
               <TextBlock x:Name="txtPane" FontSize="10" Loaded="stackMin_Loaded" />           
            </DataTemplate>       
        </UserControl.Resources>

    And here is my C# code behind

    private void reportTileView_MaximizedStateChanged(object sender, Infragistics.Controls.Lists.TileStateChangedEventArgs e)
            {
                Infragistics.Controls.Lists.TilePane pane = e.Element as Infragistics.Controls.Lists.TilePane;

                if (pane == null)
                    return;

                switch (e.NewState)
                {
                    case Infragistics.Controls.Lists.TileState.Normal:
                        pane.ContentTemplate = this.Resources["UserTemplate"] as DataTemplate;
                        break;
                    case Infragistics.Controls.Lists.TileState.Minimized:
                        pane.ContentTemplate = this.Resources["UserTemplateMinimized"] as DataTemplate;
                        if (oText != null)
                        {
                            ((TextBlock)this.oText).Text = "Some Description";
                        }
                        break;
                    case Infragistics.Controls.Lists.TileState.Maximized:
                        pane.ContentTemplate = this.Resources["UserTemplateMaximized"] as DataTemplate;
                        if (oFrame != null)
                        {
                            ((Frame)this.oFrame).Navigate(new Uri(((Reports)pane.Tag).URL, UriKind.Relative));
                        }
                        break;
                    default:
                        break;
                }
            }

            private void StackMax_Loaded(object sender, RoutedEventArgs e)
            {
                oFrame = (sender as FrameworkElement).FindName("navFrame");
            }

            private void stackMin_Loaded(object sender, RoutedEventArgs e)
            {
                oText = (sender as FrameworkElement).FindName("txtPane");
            }

    The issues I am facing is

    1) For some reason, I never hit the states Normal and Minimized.

    2) Since reportTileView_MaximizedStateChanged is hit before StackMax_Loaded, I never navigate to the desired page at the first time.

    3) Subsequent attempts to maximize the panel forces me to navigate to the url. How can I avoid navigating to the url everytime I maximize a page once loaded? 

    Please help me resolve these. Thanks

     

Reply Children