Exemplo n.º 1
0
        private void MyUserControl1_VisibleBoundsChanged(Windows.UI.ViewManagement.ApplicationView sensor, object args)
        {
            var Width = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Width;

            if (Width >= 500)
            {
                RelativePanel.SetRightOf(boxtest, texttest);
                RelativePanel.SetBelow(testButon, texttest);
            }
            else
            {
                RelativePanel.SetRightOf(boxtest, texttest);
                RelativePanel.SetBelow(testButon, texttest);
                RelativePanel.SetAlignBottomWith(boxtest, texttest);
            }
        }
Exemplo n.º 2
0
        private void updateUsedFiltersPanel()
        {
            Button prevBtn = null;
            int    counter = 0;

            UsedFilters_Panel.Children.Clear();

            foreach (var filter in filtersStack.getFilters())
            {
                // update usedFiltersPanel
                Button but = new Button()
                {
                    Name    = "filter_" + counter + "_" + filter.getName(),
                    Content = filter.getName().Substring(0, 1),
                    Style   = (Style)this.Resources["UsedFilter"]
                };
                but.Click += removeUsedFilter_Click;

                if (prevBtn != null)
                {
                    RelativePanel.SetRightOf(but, prevBtn);
                }

                UsedFilters_Panel.Children.Add(but);

                if (filter.GetType() == typeof(MatrixFilter))
                {
                    Match mat_dim = Regex.Match(filter.getName(), "_(.*)$");

                    TextBlock tb_mat = new TextBlock()
                    {
                        Text  = mat_dim.Groups[1].Value,
                        Style = (Style)this.Resources["UsedFilter_matrix"]
                    };

                    RelativePanel.SetAlignRightWith(tb_mat, but);
                    RelativePanel.SetAlignBottomWith(tb_mat, but);

                    UsedFilters_Panel.Children.Add(tb_mat);
                }



                prevBtn = but;
                counter++;
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // Check if Boo is right of Kevin
            var theRightStuff = RelativePanel.GetRightOf(Stuart);

            // We'll check for Boo, not Kevin
            // The first call this returns the string "Kevin", only later it returns the Image "Kevin".

            // Historic C#
            // if (theRightStuff is Image && ((String)((Image)theRightStuff).Tag) == "Boo") //

            // New C#
            if ((theRightStuff as Image)?.Tag?.ToString() == "Boo")
            {
                // Remove Boo
                RelativePanel.SetRightOf(Stuart, Kevin);
                MinionPanel.Children.Remove((UIElement)theRightStuff);
            }
            else
            {   // Insert Boo
                var boo = new Image()
                {
                    Source = new BitmapImage(new Uri("ms-appx:/Assets/Boo.png")),
                    Width  = 300,
                    Tag    = "Boo"
                };

                // Prepare Boo
                RelativePanel.SetRightOf(boo, Kevin);
                RelativePanel.SetAlignBottomWith(boo, Kevin);

                // Add Boo
                MinionPanel.Children.Add(boo);

                // Link to Stuart
                // Don't do this - it does not draw Boo (Stuart still has RightOf Kevin):
                // RelativePanel.SetLeftOf(boo, Stuart);

                // Override the graph edge:
                RelativePanel.SetRightOf(Stuart, boo);
            }
        }