コード例 #1
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Get our sample data
            var sampleData = new Controls_FlipView.Data.SampleDataSource();

            // Construct the table of contents used for navigating the FlipView
            // Create a StackPanel to host the TOC
            StackPanel sp = new StackPanel();

            sp.Orientation         = Orientation.Vertical;
            sp.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
            sp.VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Top;

            // Add the TOC title
            TextBlock tb = new TextBlock();

            tb.Text  = "Table of Contents";
            tb.Style = this.Resources["TOCTitle"] as Style;
            sp.Children.Add(tb);

            // Create the TOC from the data
            // Use buttons for each TOC entry using the Tag property
            // to contain the index of the target
            int i = 0;

            foreach (SampleDataItem item in sampleData.Items)
            {
                Button b = new Button();
                b.Style   = this.Resources["ButtonStyle1"] as Style;
                b.Content = item.Title;
                b.Click  += TOCButton_Click;
                b.Tag     = (++i).ToString();
                sp.Children.Add(b);
            }

            // Add the TOC to our data set
            sampleData.Items.Insert(0, sp);

            // Use a template selector to style the TOC entry differently from the other data entries
            FlipView3.ItemTemplateSelector = new ItemSelector();
            FlipView3.ItemsSource          = sampleData.Items;
        }
コード例 #2
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Get our sample data
            var sampleData = new Controls_FlipView.Data.SampleDataSource();

            // Construct the table of contents used for navigating the FlipView
            // Create a StackPanel to host the TOC
            StackPanel sp = new StackPanel();
            sp.Orientation = Orientation.Vertical;
            sp.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
            sp.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;

            // Add the TOC title
            TextBlock tb = new TextBlock();
            tb.Text = "Table of Contents";
            tb.Style = this.Resources["TOCTitle"] as Style;
            sp.Children.Add(tb);

            // Create the TOC from the data
            // Use buttons for each TOC entry using the Tag property
            // to contain the index of the target
            int i = 0;
            foreach (SampleDataItem item in sampleData.Items)
            {
                Button b = new Button();
                b.Style = this.Resources["ButtonStyle1"] as Style;
                b.Content = item.Title;
                b.Click += TOCButton_Click;
                b.Tag = (++i).ToString();
                sp.Children.Add(b);
            }

            // Add the TOC to our data set
            sampleData.Items.Insert(0, sp);

            // Use a template selector to style the TOC entry differently from the other data entries
            FlipView3.ItemTemplateSelector = new ItemSelector();
            FlipView3.ItemsSource = sampleData.Items;
        }