Inheritance: Panel, IStackPanel, IScrollSnapPointsInfo
        void init()
        {
            Width = DeviceWidth;
            Height = DeviceHeight;
            _elements = new List<ISlideElement>();
            //Scrol view
            _mainscroll = new ScrollViewer()
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
                VerticalScrollMode = ScrollMode.Auto,
                Width = DeviceWidth,
                Height = DeviceHeight,
                ZoomMode = ZoomMode.Enabled
            };
            Children.Add(_mainscroll);

            _paneltransform = new CompositeTransform();

            _contentpanel = new StackPanel()
            {
                Orientation = Orientation.Vertical,
                Width = DeviceWidth,
                RenderTransform = _paneltransform
            };
            _mainscroll.Content = _contentpanel;

        }
 public IndiagramView()
 {
     Orientation = Orientation.Vertical;
     var indiaSize = SettingsService.IndiagramDisplaySize;
     var margin = indiaSize / 10;
     Width = indiaSize + 2 * margin;
     Children.Clear();
     _image = new Image()
     {
         Margin = new Thickness(0, margin, 0, 0),
         Height = SettingsService.IndiagramDisplaySize,
         Width = SettingsService.IndiagramDisplaySize,
     };
     _textBlock = new TextBlock()
     {
         Margin = new Thickness(margin, 0, margin, 0),
         FontSize = SettingsService.FontSize,
         TextWrapping = TextWrapping.Wrap,
         HorizontalAlignment = HorizontalAlignment.Center,
         FontFamily = new FontFamily(SettingsService.FontName)
     };
     _redRect = new StackPanel()
     {
         Margin = new Thickness(0, margin, 0, 0),
         Height = SettingsService.IndiagramDisplaySize,
         Width = SettingsService.IndiagramDisplaySize,
         Background = new SolidColorBrush(Colors.Red)
     };
     Children.Insert(0, _image);
     Children.Add(_textBlock);
 }
 /// <summary>
 /// This method will change the style of each AppBarButton to use a green foreground color
 /// </summary>
 /// <param name="panel"></param>
 private void ColorButtons(StackPanel panel)
 {
     int count = 0;
     foreach (var item in panel.Children)
     {
         // For AppBarButton, change the style
         if (item.GetType() == typeof(AppBarButton))
         {
             if (count == 0)
             {
                 originalButtonStyle = ((AppBarButton)item).Style;
             }
             ((AppBarButton)item).Style = rootPage.Resources["GreenAppBarButtonStyle"] as Style;
             count++;
         }
         else
         {
             // For AppBarSeparator(s), just change the foreground color
             if (item.GetType() == typeof(AppBarSeparator))
             {
                 originalSeparatorBrush = ((AppBarSeparator)item).Foreground;
                 ((AppBarSeparator)item).Foreground = new SolidColorBrush(Color.FromArgb(255, 90, 200, 90));
             }
         }
     }
 }
Exemple #4
0
        public CheckToolItemHandler()
        {
            Control = new swc.Primitives.ToggleButton {
                IsThreeState = false
            };
            swcImage = new swc.Image {
                MaxHeight = 16, MaxWidth = 16
            };
            label = new swc.TextBlock();
            var panel = new swc.StackPanel {
                Orientation = swc.Orientation.Horizontal
            };

            panel.Children.Add(swcImage);
            panel.Children.Add(label);
            Control.Content = panel;

            Control.Checked += delegate {
                Widget.OnCheckedChanged(EventArgs.Empty);
            };
            Control.Unchecked += delegate {
                Widget.OnCheckedChanged(EventArgs.Empty);
            };
            Control.Click += delegate {
                Widget.OnClick(EventArgs.Empty);
            };
        }
        private void displayModuleList(List<IModule> moduleList)
        {
            if (nestedPaneList == null)
                nestedPaneList = new List<StackPanel>();
            int size = moduleList.Count;
            int rows = (int)Math.Ceiling((decimal)size / ROW_SIZE);

            for (int n = 0; n < rows; n++)
            {
                StackPanel newPanel = new StackPanel();
                newPanel.Orientation = Orientation.Horizontal;
                nestedPaneList.Add(newPanel);
            }
            if (moduleList != null && moduleList.Count > 0)
            {
                for (int i = 0; i < moduleList.Count; i++)
                {
                    IModule module = moduleList[i] as IModule;

                    // Calcul de la position du ModuleLayout
                    int position = (int)Math.Ceiling((decimal)(i + 1) / ROW_SIZE) - 1;

                    // On crée l'objet graphique lié au module, et on lui donne sa classe
                    ModuleLayout view = new ModuleLayout(module);
                    nestedPaneList[position].Children.Add(view);
                }
            }
            foreach (StackPanel subPanel in nestedPaneList)
            {
                modulesPanel.Children.Add(subPanel);
            }
        }
        public void ChangeButtonsAmount(int amount)
        {
            ButtonsPanel.Children.Clear();

            for (int i = 0; i < amount; i++)
            {
                TextBlock tempTextBlock = new TextBlock();
                Button tempButton = new Button();
                StackPanel tempPanel = new StackPanel();

                tempTextBlock.Text = (i + 1).ToString();
                tempTextBlock.TextAlignment = TextAlignment.Center;
                tempTextBlock.Width = tempButton.Width;

                tempButton.Name = "AdditionalButton";
                tempButton.Template = ButtonTemplate;
                tempButton.Content = i + 1;
                tempButton.Click += ButtonPressed;

                tempPanel.Children.Add(tempTextBlock);
                tempPanel.Children.Add(tempButton);
                tempPanel.Width = tempButton.Width;

                ButtonsPanel.Children.Add(tempPanel);
                ButtonsPanel.Width += tempButton.Width;
            }
        }
Exemple #7
0
        void CodePage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            Current = this;
            AppBar timeTracker = new AppBar();
            var homeButton = new Button();
            homeButton.Name = "btnHome";
            homeButton.Click += HomeButton_Click;
            homeButton.Content = "Home";
            var sPanel = new StackPanel();
            sPanel.Children.Add(homeButton);
            timeTracker.Background = new SolidColorBrush(new Color { A = 33, R = 118, G = 15, B = 5 });
            var ttControl = new TimeTrackerControl();
            ttControl.CPRStartTime = CurrentCode.CPRStartTime.ToString(@"MM/dd/yyyy H\:mm");
            sPanel.Children.Add(ttControl);
            timeTracker.Content = sPanel;

            timeTracker.IsOpen = true;
            timeTracker.IsSticky = true;
            this.TopAppBar = timeTracker;

            if (CurrentDefibrillation.Resuscitations == null)
            {
                CurrentDefibrillation.Resuscitations = new List<Resuscitation>();
            }
        }
        void init()
        {
            Width = 1600.0;
            Height = 900.0;
            _currentHeight = 900.0;

            _contentpanel = new StackPanel() { Orientation = Orientation.Vertical };
            _contentpanel.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
            _contentpanel.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
            _contentpanel.RenderTransform = new CompositeTransform() { TranslateX = 320.0 };
            _contentpanel.Width = 560.0;
            _contentpanel.SizeChanged += _contentpanel_SizeChanged;
            Children.Add(_contentpanel);

            Grid header = new Grid() { Width = 100.0, Height = 250.0 };
            Grid footer = new Grid() { Width = 100.0, Height = 250.0 };
            Grid separation = new Grid() { Width = 100.0, Height = 78.0 };
            _titleblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 26, FontWeight = Windows.UI.Text.FontWeights.Light };
            _titleblock.LayoutUpdated += _titleblock_LayoutUpdated;
            _contentblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 33, FontWeight = Windows.UI.Text.FontWeights.Light, FontStyle = Windows.UI.Text.FontStyle.Italic };
            _contentblock.LayoutUpdated += _contentblock_LayoutUpdated;

            //childrens of content
            _contentpanel.Children.Add(header);
            _contentpanel.Children.Add(_contentblock);
            _contentpanel.Children.Add(separation);
            _contentpanel.Children.Add(_titleblock);
            _contentpanel.Children.Add(footer);
        }
Exemple #9
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot              = (ContosoCookbook.Common.LayoutAwarePage) this.FindName("pageRoot");
            itemsViewSource       = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("itemsViewSource");
            PageAppBar            = (Windows.UI.Xaml.Controls.AppBar) this.FindName("PageAppBar");
            LeftCommands          = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("LeftCommands");
            RightCommands         = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("RightCommands");
            BragButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("BragButton");
            PinRecipeButton       = (Windows.UI.Xaml.Controls.Button) this.FindName("PinRecipeButton");
            flipView              = (Windows.UI.Xaml.Controls.FlipView) this.FindName("flipView");
            portraitFlipView      = (Windows.UI.Xaml.Controls.FlipView) this.FindName("portraitFlipView");
            snappedFlipView       = (Windows.UI.Xaml.Controls.FlipView) this.FindName("snappedFlipView");
            backButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
Exemple #10
0
        public async void Scan()
        {
            var access = await WiFiAdapter.RequestAccessAsync();
            var result = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector());
            if (result.Count >= 1)
            {
                 nwAdapter = await WiFiAdapter.FromIdAsync(result[0].Id);
                await nwAdapter.ScanAsync();

                sp.Children.Clear();
                foreach (var item in nwAdapter.NetworkReport.AvailableNetworks)
                {
                    StackPanel s = new StackPanel();
                    s.Orientation = Orientation.Horizontal;
                    Button b = new Button();
                    TextBlock t = new TextBlock();
                    t.Text = $"{item.NetworkRssiInDecibelMilliwatts} {item.ChannelCenterFrequencyInKilohertz} {item.IsWiFiDirect} {item.NetworkKind} {item.SecuritySettings.NetworkAuthenticationType} {item.SecuritySettings.NetworkAuthenticationType} {item.SignalBars} {item.Uptime}";
                    b.Content += item.Ssid;
                    
                    b.Click += B_Click;
                    s.Children.Add(b);
                    s.Children.Add(t);
                    sp.Children.Add(s);

                }
            }
        }
        public HomeWorkList(double w, double h, string icon)
        {
            this.Width = w;
            this.Height = h;
            _icon = icon;
            _mainpanel = new StackPanel() 
            {
                Width = w,
                Orientation = Orientation.Vertical,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top                 
            };

            _mainscroll = new ScrollViewer()
            {
                Width = w,
                Height =h ,
                HorizontalScrollMode = ScrollMode.Disabled,
                VerticalScrollMode = ScrollMode.Enabled,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Auto
            };

            this.Children.Add(_mainscroll);
            _mainscroll.Content = _mainpanel;
        }
        public MainPage()
        {
            this.InitializeComponent();

            for (var i = 0; i < 5; i++) // The 5 here could be any number
            {
                StackPanel sp = new StackPanel
                {
                    Name = "myPanel" + i,
                    Orientation = Orientation.Horizontal
                };
                myStackPanel.Children.Add(sp);

                for (var j = 0; j < 10; j++) // The 10 here could be any number
                {
                    sp.Children.Add(new Rectangle
                    {
                        Name = "myRectangle" + i + "-" + j,
                        Fill = new SolidColorBrush(Colors.Black),
                        Width = 20,
                        Height = 20,
                        Margin = new Thickness(1)
                    });
                }
            }
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/CollectionSummaryPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("CollectionViewSource");
            LayoutRoot           = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot");
            OrientationStates    = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates");
            Full             = (Windows.UI.Xaml.VisualState) this.FindName("Full");
            Fill             = (Windows.UI.Xaml.VisualState) this.FindName("Fill");
            Portrait         = (Windows.UI.Xaml.VisualState) this.FindName("Portrait");
            Snapped          = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
            ScrollViewer     = (Windows.UI.Xaml.Controls.ScrollViewer) this.FindName("ScrollViewer");
            CategoryPanel    = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("CategoryPanel");
            HeaderTitlePanel = (Windows.UI.Xaml.Controls.Grid) this.FindName("HeaderTitlePanel");
            ItemGridView     = (Windows.UI.Xaml.Controls.GridView) this.FindName("ItemGridView");
            ItemListView     = (Windows.UI.Xaml.Controls.ListView) this.FindName("ItemListView");
            Title            = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("Title");
            Image            = (Windows.UI.Xaml.Controls.Image) this.FindName("Image");
            DescriptionText  = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("DescriptionText");
            BackButton       = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton");
            PageTitle        = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle");
        }
Exemple #14
0
        /// <summary>
        /// Invoked whenever application code or internal processes (such as a rebuilding
        /// layout pass) call <see cref="OnApplyTemplate"/>. In simplest terms, this means the method
        /// is called just before a UI element displays in an application. Override this
        /// method to influence the default post-template logic of a class.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            contentGrid = this.GetTemplateChild(PART_CONTENT_GRID) as Grid;
            commandContainer = this.GetTemplateChild(PART_COMMAND_CONTAINER) as Grid;
            leftCommandPanel = this.GetTemplateChild(PART_LEFT_COMMAND_PANEL) as StackPanel;
            rightCommandPanel = this.GetTemplateChild(PART_RIGHT_COMMAND_PANEL) as StackPanel;

            transform = contentGrid.RenderTransform as CompositeTransform;

            leftCommandTransform = leftCommandPanel.RenderTransform as CompositeTransform;
            rightCommandTransform = rightCommandPanel.RenderTransform as CompositeTransform;

            contentGrid.ManipulationDelta += ContentGrid_ManipulationDelta;
            contentGrid.ManipulationCompleted += ContentGrid_ManipulationCompleted;

            contentAnimation = new DoubleAnimation();
            Storyboard.SetTarget(contentAnimation, transform);
            Storyboard.SetTargetProperty(contentAnimation, "TranslateX");
            contentAnimation.To = 0;
            contentAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(100));

            contentStoryboard = new Storyboard();
            contentStoryboard.Children.Add(contentAnimation);

            commandContainer.Background = LeftBackground as SolidColorBrush;

            base.OnApplyTemplate();
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/CollectionSummaryPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("CollectionViewSource");
            LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot");
            OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates");
            Full = (Windows.UI.Xaml.VisualState)this.FindName("Full");
            Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill");
            Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            ScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("ScrollViewer");
            CategoryPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("CategoryPanel");
            HeaderTitlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("HeaderTitlePanel");
            ItemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("ItemGridView");
            ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView");
            Title = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("Title");
            Image = (Windows.UI.Xaml.Controls.Image)this.FindName("Image");
            DescriptionText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("DescriptionText");
            BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton");
            PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle");
        }
        private void AddExample(IpaSymbol ipaSymbol)
        {
            TextBlock letterBlock = new TextBlock();
            letterBlock.Style = this.Resources["LetterStyle"] as Style;
            letterBlock.Text = ipaSymbol.Value;

            TextBlock exampleBlock = new TextBlock();
            exampleBlock.Style = this.Resources["ExampleStyle"] as Style;
            IpaSymbol.SetExampleBlock(exampleBlock);

            StackPanel stackPanel = new StackPanel();
            stackPanel.VerticalAlignment = VerticalAlignment.Center;
            stackPanel.Children.Add(letterBlock);
            stackPanel.Children.Add(exampleBlock);

            Grid grid = new Grid();
            grid.Background = ipaSymbol.BackgroundBrush;
            grid.Height = Window.Current.Bounds.Height;
            grid.Children.Add(stackPanel);

            WordsPanel.Children.Add(grid);
            WordsPanel.InvalidateArrange();
            Debug.WriteLine(grid.ActualHeight);
            //Debug.WriteLine(WordsPanel.Children.Count);
        }
Exemple #17
0
 protected override void OnApplyTemplate()  //每当应用程序代码或内部进程调用ApplyTemplate
 //,都将调用此方法.简单说,就是UI元素在显示前都会调用此方法.
 {
     base.OnApplyTemplate();
     this.stackpanel = this.GetTemplateChild("StackPanel") as StackPanel;
     this.ParseText(this.Text);
 }
        private StackPanel CreateNode(Node node)
        {
            StackPanel nodePanel = new StackPanel();
            nodePanel.Orientation = Orientation.Vertical;
            nodePanel.Margin = new Thickness(5);
            nodePanel.BorderThickness = new Thickness(1);
            nodePanel.BorderBrush = new SolidColorBrush(Colors.Black);
            nodePanel.Background = new SolidColorBrush(Colors.Gray);

            StackPanel titlePanel = new StackPanel();
            titlePanel.Background = new SolidColorBrush(Colors.Gainsboro);
            titlePanel.Height = 30;

            titlePanel.Children.Add(new TextBlock { Text = "Node id: " + node.nodeId, Margin = new Thickness(5), FontWeight = FontWeights.SemiBold });

            nodePanel.Children.Add(titlePanel);

            if (node.name != null)
                nodePanel.Children.Add(new TextBlock { Text = node.name, Margin = new Thickness(5), Foreground = new SolidColorBrush(Colors.Gainsboro) });

            if (node.version != null)
                nodePanel.Children.Add(new TextBlock { Text = "Version: " + node.version, Margin = new Thickness(5), Foreground = new SolidColorBrush(Colors.Gainsboro) });

            nodePanel.Children.Add(new TextBlock { Text = "Registered: " + node.registered, Margin = new Thickness(5), Foreground = new SolidColorBrush(Colors.Gainsboro) });

            string lastSeenAgo = string.Format("{0:hh\\:mm\\:ss}",  DateTime.Now.Subtract(node.lastSeen));
            nodePanel.Children.Add(new TextBlock { Text = "Last seen: " + lastSeenAgo+" ago", Margin = new Thickness(5), Foreground = new SolidColorBrush(Colors.Gainsboro) });

            if (node.isRepeatingNode == null)
                nodePanel.Children.Add(new TextBlock
                {
                    Text = "Repeating: Unknown",
                    Margin = new Thickness(5),
                    Foreground = new SolidColorBrush(Colors.Gainsboro)
                });
            else if (node.isRepeatingNode.Value)
                nodePanel.Children.Add(new TextBlock
                {
                    Text = "Repeating: Yes",
                    Margin = new Thickness(5),
                    Foreground = new SolidColorBrush(Colors.Gainsboro)
                });
            else
                nodePanel.Children.Add(new TextBlock
                {
                    Text = "Repeating: No",
                    Margin = new Thickness(5),
                    Foreground = new SolidColorBrush(Colors.Gainsboro)
                });

            if (node.batteryLevel != null)
                nodePanel.Children.Add(new TextBlock { Text = "Battery: " + node.batteryLevel.Value, Margin = new Thickness(5), Foreground = new SolidColorBrush(Colors.Gainsboro) });

            foreach (Sensor sensor in node.sensors)
            {
                StackPanel sensorPanel = CreateSensor(sensor);
                nodePanel.Children.Add(sensorPanel);
            }
            return nodePanel;
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///CommentPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (TheBellyofAuthority.Common.LayoutAwarePage)this.FindName("pageRoot");
            commentBar = (Windows.UI.Xaml.Controls.AppBar)this.FindName("commentBar");
            DeleteButton = (Windows.UI.Xaml.Controls.Button)this.FindName("DeleteButton");
            EditButton = (Windows.UI.Xaml.Controls.Button)this.FindName("EditButton");
            commentThread = (Windows.UI.Xaml.Controls.ListView)this.FindName("commentThread");
            commentLabel = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("commentLabel");
            commentBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("commentBox");
            postButton = (Windows.UI.Xaml.Controls.Button)this.FindName("postButton");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            UserPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("UserPanel");
            progBar = (Windows.UI.Xaml.Controls.ProgressBar)this.FindName("progBar");
            LabelBox = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("LabelBox");
            UserBox = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("UserBox");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/DetailPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("CollectionViewSource");
            LayoutRoot           = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot");
            OrientationStates    = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates");
            Full           = (Windows.UI.Xaml.VisualState) this.FindName("Full");
            Fill           = (Windows.UI.Xaml.VisualState) this.FindName("Fill");
            Portrait       = (Windows.UI.Xaml.VisualState) this.FindName("Portrait");
            Snapped        = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
            FlipView       = (Windows.UI.Xaml.Controls.FlipView) this.FindName("FlipView");
            ApplicationBar = (Windows.UI.Xaml.Controls.ApplicationBar) this.FindName("ApplicationBar");
            NextPanel      = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("NextPanel");
            NextButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("NextButton");
            PreviousButton = (Windows.UI.Xaml.Controls.Button) this.FindName("PreviousButton");
            HomeButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("HomeButton");
            BackButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton");
            PageTitle      = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle");
        }
        private void UpdateContent()
        {
            if (this.Element.Image != null)
            {
                var stackPanel = new WC.StackPanel()
                {
                    Orientation = WC.Orientation.Horizontal
                };
                var img = new WC.Image()
                {
                    Source = new WX.Media.Imaging.BitmapImage(new Uri("ms-appx:///" + this.Element.Image.File)),
                    Width  = 30,
                    Height = 30,
                    Margin = new WX.Thickness(0.0, 0.0, 20.0, 0.0),
                };

                img.ImageOpened += ImageOpened;
                stackPanel.Children.Add(img);

                if (this.Element.Text != null)
                {
                    stackPanel.Children.Add(new WC.TextBlock()
                    {
                        Text = this.Element.Text
                    });
                }
                this.Control.Content = (object)stackPanel;
            }
            else
            {
                this.Control.Content = (object)this.Element.Text;
            }
        }
Exemple #22
0
        public static async void ShowContentDialog(string dialogTitle, string dialogMessage)
        {
            var dialog = new ContentDialog()
            {
                Title = string.IsNullOrEmpty(dialogTitle) ? "Storage Demo Client" : dialogTitle
            };

            // Setup Content
            var panel = new StackPanel();

            panel.Children.Add(new TextBlock
            {
                Text = dialogMessage,
                TextWrapping = TextWrapping.Wrap,
            });

            dialog.Content = panel;

            // Add Buttons
            dialog.PrimaryButtonText = "Close";
            dialog.IsPrimaryButtonEnabled = false;
            
            // Show Dialog
            var result = await dialog.ShowAsync();
        }
Exemple #23
0
        public static StackPanel EventItem(string eventName, string imagePath)
        {
            StackPanel member = new StackPanel()
            {
                Name = eventName,
                Orientation = Orientation.Horizontal
            };

            Image photo = new Image()
            {
                Height = 50,
                Stretch = Stretch.Fill,
                Source = new BitmapImage(new Uri("ms-appx:///Assets/Sigil/" + imagePath))
            };

            member.Children.Add(photo);

            TextBlock eventsName = new TextBlock()
            {
                Width = 300,
                TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap,
                Text = eventName,
                FontSize = 25
            };

            var margin = member.Margin;
            margin.Left = margin.Right = margin.Top = margin.Bottom = 5;
            eventsName.Margin = member.Margin = margin;

            member.Children.Add(eventsName);

            return member;
        }
Exemple #24
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///Tweet.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemListScrollViewer2 = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer2");
            PeerTweets = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PeerTweets");
            itemListView2 = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView2");
            TweetBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("TweetBox");
            TweetIt = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetIt");
            PinPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("PinPanel");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            PinTb = (Windows.UI.Xaml.Controls.TextBox)this.FindName("PinTb");
            VerifyPinButton = (Windows.UI.Xaml.Controls.Button)this.FindName("VerifyPinButton");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            pageSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageSubtitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
            TwitterConnectBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("TwitterConnectBtn");
            RefreshButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RefreshButton");
        }
        void init()
        {
            Width = 1600.0;
            Height = 900.0;
            _currentHeight = 900.0;

            _contentpanel = new StackPanel() { Orientation = Orientation.Vertical };
            _contentpanel.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Right;
            _contentpanel.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
            _contentpanel.RenderTransform = new CompositeTransform() { TranslateX = -160.0 };
            _contentpanel.Width = 560.0;
            //_contentpanel.Background = new SolidColorBrush(Colors.YellowGreen);
            _contentpanel.SizeChanged += _contentpanel_SizeChanged;
            Children.Add(_contentpanel);

            Grid header = new Grid() { Width = 100.0, Height = 182.0 };
            Grid footer = new Grid() { Width = 100.0, Height = 182.0 };
            Grid separation = new Grid() { Width = 100.0, Height = 66.0 };
            _titleblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 56 , TextAlignment = Windows.UI.Xaml.TextAlignment.Right};
            _titleblock.LayoutUpdated +=_titleblock_LayoutUpdated;
            _contentblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 33, FontWeight = Windows.UI.Text.FontWeights.Light, TextAlignment = Windows.UI.Xaml.TextAlignment.Right };
            _contentblock.LayoutUpdated += _contentblock_LayoutUpdated;

            //childrens of content
            _contentpanel.Children.Add(header);
            _contentpanel.Children.Add(_titleblock);
            _contentpanel.Children.Add(separation);
            _contentpanel.Children.Add(_contentblock);
            _contentpanel.Children.Add(footer);
        }
Exemple #26
0
        private async void showDialog()
        {
            dialog = new ContentDialog()
            {
                Title = "Authenticeren met de Hue Bridge",
                MaxWidth = this.ActualWidth,
                Background = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff))
            };

            var panel = new StackPanel();

            panel.Children.Add(new TextBlock
            {
                Text = "Druk op de link knop op uw Hue bridge om verbinding te maken.",
                TextWrapping = TextWrapping.Wrap
            });

            BitmapImage bitmapImage = new BitmapImage(new Uri("ms-appx:///Assets/smartbridge.jpg"));

            panel.Children.Add(new Image
            {
                Source = bitmapImage
            });

            dialog.Content = panel;
            var result = await dialog.ShowAsync();
        }
        void init()
        {
            Width = DeviceWidth;
            Height = DeviceHeight;
            _actualheight = DeviceHeight;

            _contentpanel = new StackPanel() { Orientation = Orientation.Vertical };
            _contentpanel.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
            _contentpanel.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
            _contentpanel.RenderTransform = new CompositeTransform() { TranslateX = 320 };
            _contentpanel.SizeChanged += _contentpanel_SizeChanged;
            _contentpanel.Width = 586.0;
            
            Children.Add(_contentpanel);

            Grid header = new Grid() { Width = 100.0, Height = 214.0 };
            Grid footer = new Grid() { Width = 100.0, Height = 214.0 };
            Grid separation = new Grid() { Width = 100.0, Height = 66.0 };
            _titleblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 56 };
            _titleblock.LayoutUpdated += _titleblock_LayoutUpdated;

            _itemspanel = new StackPanel() { Orientation = Orientation.Vertical };
            _itemspanel.LayoutUpdated += _itemspanel_LayoutUpdated;
            _itemspanel.Width = 560.0;

            //childrens of content
            _contentpanel.Children.Add(header);
            _contentpanel.Children.Add(_titleblock);
            _contentpanel.Children.Add(separation);
            _contentpanel.Children.Add(_itemspanel);
            _contentpanel.Children.Add(footer);
        }
Exemple #28
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                ObservableCollection<MalfunctionGroup> malfunctionGroupItems = ReadDataHelper.GetAll<MalfunctionGroup>();
                ObservableCollection<Malfunction> malfunctions = ReadDataHelper.GetAll<Malfunction>();

                foreach (MalfunctionGroup item in malfunctionGroupItems)
                {
                    var stackPanel = new StackPanel();
                    int itemId = item.Id;
                    foreach (Malfunction malfunction in malfunctions.Where(i => i.GroupId == itemId))
                    {
                        stackPanel.Children.Add(LayoutObjectFactory.CreateTextBlock(malfunction.Text));
                    }

                    if (MalfunctionBlock.Items != null)
                    {
                        MalfunctionBlock.Items.Add(LayoutObjectFactory.CreatePivotItem(item.Text, stackPanel));
                    }
                }

                LayoutObjectFactory.AddBottomAppBar(this);
            }
            catch (Exception)
            {
                Frame.Navigate(typeof (ErrorPage));
            }
        }
        private void showPopup_Click(object sender, RoutedEventArgs e)
        {
            // Create some content to show in the popup. Typically you would // create a user control.
            Border border = new Border();
            border.BorderThickness = new Thickness(5.0);

            StackPanel panel1 = new StackPanel();

            Button button1 = new Button();
            button1.Content = "Close";
            button1.Margin = new Thickness(5.0);
            button1.Click += new RoutedEventHandler(button1_Click);
            TextBlock textblock1 = new TextBlock();
            textblock1.Text = "The popup control";
            textblock1.Margin = new Thickness(5.0);
            panel1.Children.Add(textblock1);
            panel1.Children.Add(button1);
            border.Child = panel1;

            MoviePlayer MovieFrame = new MoviePlayer(ref p);

            // Set the Child property of Popup to the border // which contains a stackpanel, textblock and button.
            p.Child = MovieFrame;

            // Set where the popup will show up on the screen.
            p.VerticalOffset = 110;
            p.HorizontalOffset = 0;

            // Open the popup.
            p.IsLightDismissEnabled = true;
            p.IsOpen = true;
        }
Exemple #30
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ArtistDetails.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemDetail = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemDetail");
            itemDetailGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("itemDetailGrid");
            itemDetailTitlePanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("itemDetailTitlePanel");
            ArtistContentTb = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("ArtistContentTb");
            itemTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemTitle");
            itemSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemSubtitle");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
        }
        public ColorList1Page() {
            this.InitializeComponent();

            IEnumerable<PropertyInfo> properties = typeof(Colors).GetTypeInfo().DeclaredProperties;

            foreach (PropertyInfo property in properties) {
                Color clr = (Color)property.GetValue(null);

                StackPanel vertStackPanel = new StackPanel { VerticalAlignment = VerticalAlignment.Center };
                TextBlock txtblkName = new TextBlock {
                    Text = property.Name,
                    FontSize = 24 };
                TextBlock txtblkRgb = new TextBlock {
                    Text = String.Format("{0:X2}-{1:X2}-{2:X2}-{3:X2}", clr.A, clr.R, clr.G, clr.B),
                    FontSize = 18
                };
                vertStackPanel.Children.Add(txtblkName);
                vertStackPanel.Children.Add(txtblkRgb);

                StackPanel horzStackPanel = new StackPanel { Orientation = Orientation.Horizontal };
                Rectangle rectangle = new Rectangle {
                    Width = 72,
                    Height = 72,
                    Fill = new SolidColorBrush(clr),
                    Margin = new Thickness(6)
                };
                horzStackPanel.Children.Add(rectangle);
                horzStackPanel.Children.Add(vertStackPanel);
                stackPanel.Children.Add(horzStackPanel);

            }

        }
        private void BlankPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            SettingsCommand cmd = new SettingsCommand("sample", "Sample Custom Setting", (x) =>
            {
                SettingsFlyout settings = new SettingsFlyout();
                settings.FlyoutWidth = (Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth)Enum.Parse(typeof(Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth), settingswidth.SelectionBoxItem.ToString());
                //settings.HeaderBrush = new SolidColorBrush(Colors.Orange);
                //settings.Background = new SolidColorBrush(Colors.White);
                settings.HeaderText = "Foo Bar Custom Settings";

                BitmapImage bmp = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png"));

                settings.SmallLogoImageSource = bmp;

                StackPanel sp = new StackPanel();

                ToggleSwitch ts = new ToggleSwitch();
                ts.Header = "Download updates automatically";

                Button b = new Button();
                b.Content = "Test";

                sp.Children.Add(ts);
                sp.Children.Add(b);

                settings.Content = sp;

                settings.IsOpen = true;

                ObjectTracker.Track(settings);
            });

            args.Request.ApplicationCommands.Add(cmd);
        }
        public void Populate(IEnumerable<ILayer> layers)
        {
            Children.Clear();
            foreach (var layer in layers)
            {
                if (string.IsNullOrEmpty(layer.Attribution.Text)) continue;
                var attribution = new StackPanel { Orientation = Orientation.Horizontal };
                var textBlock = new TextBlock();
                if (string.IsNullOrEmpty(layer.Attribution.Url))
                {
                    textBlock.Text = layer.Attribution.Text;
                }
                else
                {
                    var hyperlink = new Hyperlink();
                    hyperlink.Inlines.Add(new Run{ Text = layer.Attribution.Text});
                    hyperlink.NavigateUri = new Uri(layer.Attribution.Url);
                    textBlock.Inlines.Add(hyperlink);
                    textBlock.Padding = new Thickness(6, 2, 6, 2);
                    attribution.Children.Add(textBlock);
                }

                Children.Add(attribution);
            }
        }
        private async void ButtonValid_Click(object sender, RoutedEventArgs e) {
            Exception lastException;
            try {
                await StorageFolder.GetFolderFromPathAsync(BoxFolderPath.Text);
                return;
            } catch (Exception ex) {
                lastException = ex;
            }

            string text = lastException.Message.TrimEnd(Environment.NewLine.ToCharArray());

            var panel = new StackPanel() {
                Orientation = Orientation.Vertical
            };
            if (lastException is UnauthorizedAccessException) {
                var button = new Button() {
                    Content = "Manage accessable folders"
                };
                button.Click += (a, b) => {
                    ParentPage.App.SplitPage.Navigate<PreferencesPage>(1);
                };
                panel.Children.Add(button);
            }
            panel.Children.Add(new TextBlock() {
                Text = text
            });

            ButtonValid.AttachFlyout(new Flyout() {
                Content = panel
            });
            ButtonValid.ShowFlyout();
        }
        public static StackPanel BulletPoint(string contents, string bulletCode)
        {
            StackPanel member = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            TextBlock bullet = new TextBlock()
            {
                Text = bulletCode,
                Width = 40,
                FontSize = 30
            };

            TextBlock content = new TextBlock()
            {
                Width = 300,
                TextWrapping = Windows.UI.Xaml.TextWrapping.WrapWholeWords,
                Text = contents,
                FontSize = 20
            };

            member.Children.Add(bullet);
            member.Children.Add(content);

            var margin = member.Margin;
            margin.Bottom = 10;
            member.Margin = margin;

            return member;
        }
 public DisplayTextBox(Windows.UI.Xaml.Controls.StackPanel p, string s)
 {
     this.textB = new TextBox();
     p.Children.Add(this.textB);
     this.textB.Height  = 30;
     this.textB.Margin  = new Windows.UI.Xaml.Thickness(0, 5, 0, 15);
     this.textB.Padding = new Windows.UI.Xaml.Thickness(10, 3, 10, 5);
     this.textB.Name    = s;
 }
 public DisplayNotesStack(Windows.UI.Xaml.Controls.StackPanel p, string t1, string t2)
 {
     this.stackP = new StackPanel();
     p.Children.Add(this.stackP);
     this.stackP.Margin = new Windows.UI.Xaml.Thickness(0, 0, 40, 0);
     this.stackP.Width  = 540;
     DisplayTextBlock text1 = new DisplayTextBlock(this.stackP, t1);
     DisplayNotesBox  memo  = new DisplayNotesBox(this.stackP, t2);
 }
Exemple #38
0
            sw.FrameworkElement SetupCell(sw.FrameworkElement element)
            {
                var container = new swc.StackPanel {
                    Orientation = swc.Orientation.Horizontal
                };

                container.Children.Add(Image());
                container.Children.Add(element);
                return(Handler.SetupCell(container));
            }
 public DisplayTextBlockStack(Windows.UI.Xaml.Controls.StackPanel p, string t1, string t2, string t3, string t4)
 {
     this.stackP = new StackPanel();
     p.Children.Add(this.stackP);
     this.stackP.Margin = new Windows.UI.Xaml.Thickness(0, 0, 10, 0);
     this.stackP.Width  = 120;
     DisplayTextBlock text1 = new DisplayTextBlock(this.stackP, t1);
     DisplayTextBlock text2 = new DisplayTextBlock(this.stackP, t2);
     DisplayTextBlock text3 = new DisplayTextBlock(this.stackP, t3);
     DisplayTextBlock text4 = new DisplayTextBlock(this.stackP, t4);
 }
 public DisplayTextBoxStack(Windows.UI.Xaml.Controls.StackPanel p)
 {
     this.stackP = new StackPanel();
     p.Children.Add(this.stackP);
     this.stackP.Margin = new Windows.UI.Xaml.Thickness(0, 0, 40, 0);
     this.stackP.Width  = 300;
     DisplayTextBox text1 = new DisplayTextBox(this.stackP, "year");
     DisplayTextBox text2 = new DisplayTextBox(this.stackP, "make");
     DisplayTextBox text3 = new DisplayTextBox(this.stackP, "model");
     DisplayTextBox text4 = new DisplayTextBox(this.stackP, "source");
 }
 public DisplaySoloSliderStack(Windows.UI.Xaml.Controls.StackPanel p,
                               string t1, int min1, int max1, string minText1, string maxText1,
                               SolidColorBrush color1, SolidColorBrush color2)
 {
     this.stackP = new StackPanel();
     p.Children.Add(this.stackP);
     this.stackP.Margin = new Windows.UI.Xaml.Thickness(0, 0, 40, 0);
     this.stackP.Width  = 540;
     DisplayTextBlock text1  = new DisplayTextBlock(this.stackP, t1);
     DisplaySlider    slide1 = new DisplaySlider(this.stackP, min1, max1, minText1, maxText1, color1, color2);
 }
 public DisplayNotesBox(Windows.UI.Xaml.Controls.StackPanel p, string s)
 {
     this.textB = new TextBox();
     p.Children.Add(this.textB);
     this.textB.AcceptsReturn   = true;
     this.textB.PlaceholderText = s;
     this.textB.Width           = 500;
     this.textB.Margin          = new Windows.UI.Xaml.Thickness(40, 5, 0, 15);
     this.textB.MaxHeight       = 130;
     this.textB.Padding         = new Windows.UI.Xaml.Thickness(10, 3, 10, 5);
     this.textB.TextWrapping    = Windows.UI.Xaml.TextWrapping.Wrap;
 }
        public DisplaySlider(Windows.UI.Xaml.Controls.StackPanel p, int min, int max,
                             string minText, string maxText, SolidColorBrush color1, SolidColorBrush color2)
        {
            this.sliderStack = new StackPanel();
            p.Children.Add(this.sliderStack);
            this.sliderStack.Margin      = new Windows.UI.Xaml.Thickness(40, 0, 0, 0);
            this.sliderStack.Orientation = Orientation.Horizontal;

            TextBlock loText = new TextBlock();

            sliderStack.Children.Add(loText);
            loText.Text              = minText;
            loText.Width             = 42;
            loText.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            loText.Margin            = new Windows.UI.Xaml.Thickness(0, 0, 5, 0);
            loText.Padding           = new Windows.UI.Xaml.Thickness(0, 0, 0, 10);
            loText.FontFamily        = new FontFamily("Segoe UI");
            loText.FontSize          = 12;
            loText.LineHeight        = 20;

            this.slide = new Slider();
            sliderStack.Children.Add(slide);
            slide.Background  = color1;
            slide.Foreground  = color2;
            slide.Maximum     = max;
            slide.Minimum     = min;
            slide.LargeChange = Math.Pow(10, (Math.Floor(Math.Log10((int)(max - min))) - 1));
            if (slide.LargeChange == 0)
            {
                slide.LargeChange = 1;
            }
            slide.SmallChange   = slide.LargeChange;
            slide.StepFrequency = ((slide.LargeChange) / 10);
            //if (slide.StepFrequency == 0) slide.StepFrequency = 1;
            slide.TickFrequency     = ((max - min) / 10);
            slide.Width             = 406;
            slide.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;

            TextBlock hiText = new TextBlock();

            sliderStack.Children.Add(hiText);
            hiText.Text              = maxText;
            hiText.Width             = 42;
            hiText.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            hiText.Margin            = new Windows.UI.Xaml.Thickness(5, 0, 0, 0);
            hiText.Padding           = new Windows.UI.Xaml.Thickness(0, 0, 0, 10);
            hiText.FontFamily        = new FontFamily("Segoe UI");
            hiText.FontSize          = 12;
            hiText.LineHeight        = 20;
        }
 public DisplayTextBlock(Windows.UI.Xaml.Controls.StackPanel p, string t)
 {
     this.textB = new TextBlock();
     p.Children.Add(this.textB);
     this.textB.Text              = t;
     this.textB.Height            = 50;
     this.textB.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch;
     this.textB.Margin            = new Windows.UI.Xaml.Thickness(40, 0, 0, 0);
     this.textB.Padding           = new Windows.UI.Xaml.Thickness(0, 0, 0, 20);
     this.textB.FontFamily        = new FontFamily("Segoe UI");
     this.textB.FontSize          = 27;
     this.textB.FontWeight        = Windows.UI.Text.FontWeights.Light;
     this.textB.LineHeight        = 30;
 }
Exemple #45
0
        private void AddUWPComponents(UWPControls.Grid containerGrid)
        {
            UWPControls.StackPanel root = new UWPControls.StackPanel
            {
                HorizontalAlignment = UWPXaml.HorizontalAlignment.Center,
                VerticalAlignment   = UWPXaml.VerticalAlignment.Top
            };


            root.Children.Add(CreateInputStackPanel());
            root.Children.Add(CreateGettingDataProgressRing());
            root.Children.Add(CreateResultStackPanel());

            containerGrid.Children.Add(root);
        }
Exemple #46
0
        private UWPControls.StackPanel CreateInputStackPanel()
        {
            var inputStackPanel = new UWPControls.StackPanel();

            UWPControls.Button getTokenButton = new UWPControls.Button();
            getTokenButton.Content             = "Lấy Facebook Token";
            getTokenButton.Width               = 300;
            getTokenButton.HorizontalAlignment = UWPXaml.HorizontalAlignment.Center;
            getTokenButton.Margin              = new UWPXaml.Thickness(10);
            getTokenButton.SetBinding(UWPControls.Button.CommandProperty, new UWPXaml.Data.Binding()
            {
                Source = _viewModel,
                Path   = new UWPXaml.PropertyPath("GetTokenCommand")
            });

            UWPControls.PasswordBox passwordBox = new UWPControls.PasswordBox();
            passwordBox.PlaceholderText  = "Nhập password";
            passwordBox.Width            = 300;
            passwordBox.Margin           = new UWPXaml.Thickness(10);
            passwordBox.PasswordChanged += (o, args) => { _viewModel.UserPassword = passwordBox.Password; };

            //Thêm tooltip cho password TextBox
            UWPControls.ToolTip passwordToolTip = new UWPControls.ToolTip();
            passwordToolTip.Content =
                "Để giảm thiểu khả năng checkpoint và tăng độ bảo mật, các bạn nên dùng Mật khẩu ứng dụng. Để lấy Mật khẩu ứng dụng: Cài đặt > Bảo mật và đăng nhập > Xác thực 2 yếu tố > Mật khẩu ứng dụng";
            UWPControls.ToolTipService.SetToolTip(passwordBox, passwordToolTip);

            UWPControls.TextBox emailTextBox = new UWPControls.TextBox();
            emailTextBox.PlaceholderText     = "Nhập email";
            emailTextBox.IsSpellCheckEnabled = false;
            emailTextBox.Width  = 300;
            emailTextBox.Margin = new UWPXaml.Thickness(10);
            //https://github.com/Microsoft/XamlIslandBlogPostSample/blob/master/WpfApp1/BindingPage.xaml.cs
            emailTextBox.SetBinding(UWPControls.TextBox.TextProperty, new UWPXaml.Data.Binding()
            {
                Source = _viewModel,
                Path   = new UWPXaml.PropertyPath("UserEmail"),
                UpdateSourceTrigger = UWPXaml.Data.UpdateSourceTrigger.PropertyChanged,
                Mode = UWPXaml.Data.BindingMode.TwoWay
            });


            inputStackPanel.Children.Add(emailTextBox);
            inputStackPanel.Children.Add(passwordBox);
            inputStackPanel.Children.Add(getTokenButton);

            return(inputStackPanel);
        }
Exemple #47
0
        public ButtonToolItemHandler()
        {
            Control  = new swc.Button();
            swcImage = new swc.Image {
                MaxHeight = 16, MaxWidth = 16
            };
            label = new swc.TextBlock();
            var panel = new swc.StackPanel {
                Orientation = swc.Orientation.Horizontal
            };

            panel.Children.Add(swcImage);
            panel.Children.Add(label);
            Control.Content = panel;
            Control.Click  += delegate {
                Widget.OnClick(EventArgs.Empty);
            };
        }
        public DisplayNameBox(Windows.UI.Xaml.Controls.StackPanel p, SolidColorBrush color2)
        {
            nameBox = new Border();
            p.Children.Add(nameBox);
            nameBox.Background = color2;
            nameBox.Width      = 260;
            nameBox.Height     = p.Height;

            rowName                      = new TextBlock();
            nameBox.Child                = rowName;
            rowName.TextWrapping         = Windows.UI.Xaml.TextWrapping.WrapWholeWords;
            rowName.VerticalAlignment    = Windows.UI.Xaml.VerticalAlignment.Center;
            rowName.TextAlignment        = Windows.UI.Xaml.TextAlignment.Center;
            rowName.FontSize             = 56;
            rowName.LineHeight           = 37;
            rowName.FontFamily           = new FontFamily("Segoe UI");
            rowName.FontWeight           = Windows.UI.Text.FontWeights.Light;
            rowName.LineStackingStrategy = Windows.UI.Xaml.LineStackingStrategy.BlockLineHeight;
        }
Exemple #49
0
        public TabPageHandler()
        {
            Control = new swc.TabItem();
            var header = new swc.StackPanel {
                Orientation = swc.Orientation.Horizontal
            };

            headerImage = new swc.Image {
                MaxHeight = 16, MaxWidth = 16
            };
            headerText = new swc.TextBlock();
            header.Children.Add(headerImage);
            header.Children.Add(headerText);
            Control.Header = header;

            Control.Content = content = new swc.DockPanel {
                LastChildFill = true
            };
        }
        public VehicleDisplay(Windows.UI.Xaml.Controls.StackPanel p, VehicleWrapper theVehicle, int numVehicles)
        {
            this.theVehicle = theVehicle;

            //set colors
            SolidColorBrush color1, color2;

            switch (numVehicles % 4)
            {
            case 0:     //red
                color1 = new SolidColorBrush(Color.FromArgb(179, 212, 107, 61));
                color2 = new SolidColorBrush(Color.FromArgb(255, 118, 42, 9)); break;

            case 1:     //green
                color1 = new SolidColorBrush(Color.FromArgb(179, 31, 166, 71));
                color2 = new SolidColorBrush(Color.FromArgb(255, 21, 83, 39)); break;

            case 2:     //purple
                color1 = new SolidColorBrush(Color.FromArgb(179, 128, 74, 133));
                color2 = new SolidColorBrush(Color.FromArgb(255, 83, 19, 89)); break;

            //color1 = new SolidColorBrush(Color.FromArgb(255, 155, 22, 168)); break;
            default:     //orange
                color1 = new SolidColorBrush(Color.FromArgb(179, 228, 184, 67));
                color2 = new SolidColorBrush(Color.FromArgb(255, 220, 171, 40)); break;
            }



            //parent -> display
            this.display = new StackPanel();
            p.Children.Add(this.display);
            this.display.Background  = color1;
            this.display.Height      = 200;
            this.display.Width       = p.Width; // set width to parent's width
            this.display.Orientation = Orientation.Horizontal;

            //parent -> display -> borderName
            DisplayNameBox borderName = new DisplayNameBox(display, color2);

            updateName("New Vehicle " + (numVehicles + 1).ToString());

            //parent -> display -> scroller
            ScrollViewer scroller = new ScrollViewer();

            this.display.Children.Add(scroller);
            scroller.VerticalScrollMode = ScrollMode.Disabled;
            scroller.ZoomMode           = ZoomMode.Disabled;
            scroller.Width  = this.display.Width - 260;
            scroller.Height = this.display.Height;
            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Disabled;

            //parent -> display -> scroller -> dataStack
            StackPanel dataStack = new StackPanel();

            scroller.Content              = dataStack;
            dataStack.Height              = 200;
            dataStack.Orientation         = Orientation.Horizontal;
            dataStack.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;

            //parent -> display -> scroller -> dataStack -> descStack1
            DisplayTextBlockStack descStack1 = new DisplayTextBlockStack(dataStack, "Year:", "Make:", "Model:", "Source:");

            //parent -> display -> scroller -> dataStack -> descStack2
            DisplayTextBoxStack descStack2 = new DisplayTextBoxStack(dataStack);
            UIElementCollection textBoxes  = descStack2.stackP.Children;

            ((TextBox)textBoxes[0]).TextChanged += new TextChangedEventHandler(updateYear);
            ((TextBox)textBoxes[1]).TextChanged += new TextChangedEventHandler(updateMake);
            ((TextBox)textBoxes[2]).TextChanged += new TextChangedEventHandler(updateModel);
            ((TextBox)textBoxes[3]).TextChanged += new TextChangedEventHandler(updateSource);

            //parent -> display -> scroller -> dataStack -> priceStack
            DisplaySliderStack priceStack = new DisplaySliderStack(dataStack,
                                                                   "Price", "Cost to Repair", VehicleWrapper.MinPrice, VehicleWrapper.MaxPrice,
                                                                   "$" + VehicleWrapper.MinPrice.ToString(), "$" + VehicleWrapper.MaxPrice.ToString(),
                                                                   VehicleWrapper.MinRepairCost, VehicleWrapper.MaxRepairCost,
                                                                   "$" + VehicleWrapper.MinRepairCost.ToString(), "$" + VehicleWrapper.MaxRepairCost.ToString(),
                                                                   color1, color2);
            UIElementCollection priceStackChildren = ((StackPanel)(priceStack.stackP).Children[1]).Children;

            ((Slider)priceStackChildren[1]).ValueChanged += updatePrice;      // price
            priceStackChildren = ((StackPanel)(priceStack.stackP).Children[3]).Children;
            ((Slider)priceStackChildren[1]).ValueChanged += updateRepairCost; // repair

            //parent -> display -> scroller -> dataStack -> mileageStack
            DisplaySliderStack mileageStack = new DisplaySliderStack(dataStack,
                                                                     "Initial Mileage", "Estimated Final Mileage",
                                                                     VehicleWrapper.MinInitialMileage, VehicleWrapper.MaxInitialMileage,
                                                                     ((int)(VehicleWrapper.MinInitialMileage / 1000)).ToString() + "k",
                                                                     ((int)(VehicleWrapper.MaxInitialMileage / 1000)).ToString() + "k",
                                                                     theVehicle.MinFinalMileage, VehicleWrapper.MaxFinalMileage,
                                                                     ((int)(theVehicle.MinFinalMileage / 1000)).ToString() + "k",
                                                                     ((int)(VehicleWrapper.MaxFinalMileage / 1000)).ToString() + "k",
                                                                     color1, color2);
            UIElementCollection mileageStackChildren = ((StackPanel)(mileageStack.stackP).Children[1]).Children;

            ((Slider)mileageStackChildren[1]).ValueChanged += updateInitialMileage; // initial mileage
            mileageStackChildren = ((StackPanel)(mileageStack.stackP).Children[3]).Children;
            ((Slider)mileageStackChildren[1]).ValueChanged += updateFinalMileage;

            //parent -> display -> scroller -> dataStack -> mpgStack
            DisplaySliderStack mpgStack = new DisplaySliderStack(dataStack,
                                                                 "City MPG", "Highway MPG",
                                                                 VehicleWrapper.MinCityMPG, VehicleWrapper.MaxCityMPG,
                                                                 ((int)(VehicleWrapper.MinCityMPG)).ToString(),
                                                                 ((int)(VehicleWrapper.MaxCityMPG)).ToString(),
                                                                 VehicleWrapper.MinHighwayMPG, VehicleWrapper.MaxHighwayMPG,
                                                                 ((int)(VehicleWrapper.MinHighwayMPG)).ToString(),
                                                                 ((int)(VehicleWrapper.MaxHighwayMPG)).ToString(),
                                                                 color1, color2);
            UIElementCollection mpgStackChildren = ((StackPanel)(mpgStack.stackP).Children[1]).Children;

            ((Slider)mpgStackChildren[1]).ValueChanged += updateCityMPG;
            mpgStackChildren = ((StackPanel)(mpgStack.stackP).Children[3]).Children;
            ((Slider)mpgStackChildren[1]).ValueChanged += updateHighwayMPG;

            //parent -> display -> scroller -> dataStack -> notesStack
            DisplayNotesStack   notesStack         = new DisplayNotesStack(dataStack, "Notes:", "Insert any notes about your vehicle here.");
            UIElementCollection notesStackChildren = notesStack.stackP.Children;

            ((TextBox)notesStackChildren[1]).TextChanged += updateNotes;

            //parent -> display -> scroller -> dataStack -> deleteStack
            DisplayDeleteButton displayDeleteButton = new DisplayDeleteButton(dataStack, "Delete Vehicle", color2);
            Button deleteButton = displayDeleteButton.deleteB;

            deleteButton.Tapped += deleteVehicle;

            //parent -> memoBar
            this.memoBar = new StackPanel();
            p.Children.Add(this.memoBar);
            this.memoBar.Width       = p.Width; // set width to parent's width
            this.memoBar.Height      = 64;
            this.memoBar.Orientation = Orientation.Horizontal;

            //parent -> memoBar -> memoScroll -> memoStack -> elements
            DisplayMemoScroll  memoScroll = new DisplayMemoScroll(this.memoBar);
            StackPanel         memoStack  = (StackPanel)memoScroll.memoScroll.Content;
            DisplayMemoTextBox cpm        = new DisplayMemoTextBox(memoStack, (0.ToString("F") + "¢ per mile"), color1);

            cpm.memoText.FontSize        += 13; // make cents per mile display bigger
            cpm.memoText.FontWeight       = Windows.UI.Text.FontWeights.Thin;
            cpm.memoText.CharacterSpacing = 75;
            cpm.memoText.Margin           = new Windows.UI.Xaml.Thickness(0, 0, 0, 0);
            cpm.memoText.Width            = 225;
            DisplayMemoTextBlock totalCostLabel   = new DisplayMemoTextBlock(memoStack, "Total Cost:");
            DisplayMemoTextBox   totalCost        = new DisplayMemoTextBox(memoStack, "$" + (0.ToString()), color1);
            DisplayMemoTextBlock lifeSpanLabel    = new DisplayMemoTextBlock(memoStack, "Life Span:");
            DisplayMemoTextBox   lifeSpan         = new DisplayMemoTextBox(memoStack, (0.ToString("F") + " years"), color1);
            DisplayMemoTextBlock avgMPGLabel      = new DisplayMemoTextBlock(memoStack, "Average MPG:");
            DisplayMemoTextBox   aveMPG           = new DisplayMemoTextBox(memoStack, (1.ToString("F")), color1);
            DisplayMemoTextBlock maintenanceLabel = new DisplayMemoTextBlock(memoStack, "Maintenance:");
            DisplayMemoTextBox   maintenance      = new DisplayMemoTextBox(memoStack, "$" + (0.ToString()), color1);
            DisplayMemoTextBlock resellLabel      = new DisplayMemoTextBlock(memoStack, "Resell:");
            DisplayMemoTextBox   resell           = new DisplayMemoTextBox(memoStack, "$" + (0.ToString()), color1);
        }
Exemple #51
0
        private UWPControls.StackPanel CreateResultStackPanel()
        {
            var resultStackPanel = new UWPControls.StackPanel();

            //Dùng cho hiển thị Token

            UWPControls.TextBox fbTokenTextBox = new UWPControls.TextBox();
            fbTokenTextBox.Width           = 300;
            fbTokenTextBox.Margin          = new UWPXaml.Thickness(10);
            fbTokenTextBox.BorderThickness = new UWPXaml.Thickness(0);
            fbTokenTextBox.Background      = new UWPXaml.Media.SolidColorBrush(Windows.UI.Colors.Transparent);
            fbTokenTextBox.IsReadOnly      = true;
            fbTokenTextBox.TextWrapping    = UWPXaml.TextWrapping.Wrap;
            fbTokenTextBox.SetBinding(UWPControls.TextBox.TextProperty, new UWPXaml.Data.Binding()
            {
                Source = _viewModel,
                Path   = new UWPXaml.PropertyPath("FBToken"),
                Mode   = UWPXaml.Data.BindingMode.OneWay
            });

            UWPControls.Button copyTokenButton = new UWPControls.Button();
            copyTokenButton.Width   = 150;
            copyTokenButton.Margin  = new UWPXaml.Thickness(0, 0, 5, 0);
            copyTokenButton.Content = "Sao chép Token";
            copyTokenButton.Click  += (o, args) => { Clipboard.SetText(_viewModel.FBToken ?? string.Empty); };

            UWPControls.Button saveTokenButton = new UWPControls.Button {
                Width = 120, Content = "Lưu Token"
            };
            saveTokenButton.SetBinding(UWPControls.Button.CommandProperty, new UWPXaml.Data.Binding()
            {
                Source = _viewModel,
                Path   = new UWPXaml.PropertyPath("SaveTokenCommand")
            });

            UWPControls.StackPanel successCommandButtonsStackPanel = new UWPControls.StackPanel();
            successCommandButtonsStackPanel.Orientation         = UWPControls.Orientation.Horizontal;
            successCommandButtonsStackPanel.Margin              = new UWPXaml.Thickness(10);
            successCommandButtonsStackPanel.HorizontalAlignment = UWPXaml.HorizontalAlignment.Center;
            successCommandButtonsStackPanel.Children.Add(copyTokenButton);
            successCommandButtonsStackPanel.Children.Add(saveTokenButton);


            UWPControls.StackPanel successStackPanel = new UWPControls.StackPanel();

            successStackPanel.Children.Add(fbTokenTextBox);
            successStackPanel.Children.Add(successCommandButtonsStackPanel);

            successStackPanel.SetBinding(UWPXaml.UIElement.VisibilityProperty,
                                         new UWPXaml.Data.Binding()
            {
                Source    = _viewModel,
                Path      = new UWPXaml.PropertyPath("FBToken"),
                Converter = new NullTovisibilityConverter()
            });

            //Dùng cho hiển thị lỗi
            UWPControls.StackPanel errorStackPanel = new UWPControls.StackPanel();

            UWPControls.TextBlock errorMsgTextBlock = new UWPControls.TextBlock();
            errorMsgTextBlock.Width        = 300;
            errorMsgTextBlock.TextWrapping = UWPXaml.TextWrapping.WrapWholeWords;
            errorMsgTextBlock.Foreground   = new UWPXaml.Media.SolidColorBrush(Windows.UI.Colors.Red);
            errorMsgTextBlock.SetBinding(UWPControls.TextBlock.TextProperty, new UWPXaml.Data.Binding()
            {
                Source = _viewModel,
                Path   = new UWPXaml.PropertyPath("ErrorMsg")
            });

            errorStackPanel.Children.Add(errorMsgTextBlock);

            //Thêm cả 2 panel success và error vào panel chính
            resultStackPanel.Children.Add(errorStackPanel);
            resultStackPanel.Children.Add(successStackPanel);

            return(resultStackPanel);
        }
Exemple #52
0
        private void host_ChildChanged(object sender, EventArgs e)
        {
            try
            {
                var host = (WindowsXamlHost)sender;
                if (host.Child is Pivot pivot)
                {
                    // Home
                    var homeHeader = new Windows.UI.Xaml.Controls.StackPanel()
                    {
                        Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal,
                    };
                    homeHeader.Children.Add(new FontIcon()
                    {
                        Glyph = "\uE80F", Style = fontIconStyle
                    });
                    homeHeader.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Home", Style = headerTextBlockStyle
                    });

                    var homeContent = new Windows.UI.Xaml.Controls.Grid()
                    {
                        Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.MidnightBlue),
                    };
                    homeContent.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Home", Style = contentTextBlockStyle
                    });


                    // Shop
                    var shopHeader = new Windows.UI.Xaml.Controls.StackPanel()
                    {
                        Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal,
                    };
                    shopHeader.Children.Add(new FontIcon()
                    {
                        Glyph = "\uE719", Style = fontIconStyle
                    });
                    shopHeader.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Shop", Style = headerTextBlockStyle
                    });

                    var shopContent = new Windows.UI.Xaml.Controls.Grid()
                    {
                        Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.DeepSkyBlue),
                    };
                    shopContent.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Shop", Style = contentTextBlockStyle
                    });


                    // Payments
                    var paymentHeader = new Windows.UI.Xaml.Controls.StackPanel()
                    {
                        Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal,
                    };
                    paymentHeader.Children.Add(new FontIcon()
                    {
                        Glyph = "\uE8C7", Style = fontIconStyle
                    });
                    paymentHeader.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Payment", Style = headerTextBlockStyle
                    });

                    var paymentContent = new Windows.UI.Xaml.Controls.Grid()
                    {
                        Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.ForestGreen),
                    };
                    paymentContent.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Payment", Style = contentTextBlockStyle
                    });


                    // Reports
                    var reportsHeader = new Windows.UI.Xaml.Controls.StackPanel()
                    {
                        Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal,
                    };
                    reportsHeader.Children.Add(new FontIcon()
                    {
                        Glyph = "\uE9F9", Style = fontIconStyle
                    });
                    reportsHeader.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Reports", Style = headerTextBlockStyle
                    });

                    var reportsContent = new Windows.UI.Xaml.Controls.Grid()
                    {
                        Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Maroon),
                    };
                    reportsContent.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Reports", Style = contentTextBlockStyle
                    });


                    // Locate Branch
                    var branchHeader = new Windows.UI.Xaml.Controls.StackPanel()
                    {
                        Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal,
                    };
                    branchHeader.Children.Add(new FontIcon()
                    {
                        Glyph = "\uE707", Style = fontIconStyle
                    });
                    branchHeader.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Locate Branch", Style = headerTextBlockStyle
                    });

                    var branchContent = new Windows.UI.Xaml.Controls.Grid()
                    {
                        Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Navy),
                    };
                    branchContent.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Locate Branch", Style = contentTextBlockStyle
                    });


                    // Profile Settings
                    var profileSettingsHeader = new Windows.UI.Xaml.Controls.StackPanel()
                    {
                        Orientation = Windows.UI.Xaml.Controls.Orientation.Horizontal,
                    };
                    profileSettingsHeader.Children.Add(new FontIcon()
                    {
                        Glyph = "\uEF58", Style = fontIconStyle
                    });
                    profileSettingsHeader.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Profile Settings", Style = headerTextBlockStyle
                    });

                    var profileSettingsContent = new Windows.UI.Xaml.Controls.Grid()
                    {
                        Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Fuchsia),
                    };
                    profileSettingsContent.Children.Add(new Windows.UI.Xaml.Controls.TextBlock()
                    {
                        Text = "Profile Settings", Style = contentTextBlockStyle
                    });


                    var homePivotItem = new PivotItem()
                    {
                        Header  = homeHeader,
                        Content = homeContent,
                    };

                    var shopPivotItem = new PivotItem()
                    {
                        Header  = shopHeader,
                        Content = shopContent,
                    };

                    var paymentPivotItem = new PivotItem()
                    {
                        Header  = paymentHeader,
                        Content = paymentContent,
                    };

                    var reportsPivotItem = new PivotItem()
                    {
                        Header  = reportsHeader,
                        Content = reportsContent,
                    };

                    var branchPivotItem = new PivotItem()
                    {
                        Header  = branchHeader,
                        Content = branchContent,
                    };

                    var profileSettingsPivotItem = new PivotItem()
                    {
                        Header  = profileSettingsHeader,
                        Content = profileSettingsContent,
                    };

                    pivot.Title = "Services";
                    pivot.Items.Add(homePivotItem);
                    pivot.Items.Add(shopPivotItem);
                    pivot.Items.Add(paymentPivotItem);
                    pivot.Items.Add(reportsPivotItem);
                    pivot.Items.Add(branchPivotItem);
                    pivot.Items.Add(profileSettingsPivotItem);
                }
            }
            catch (Exception)
            {
            }
        }
        public UserDisplay(Windows.UI.Xaml.Controls.StackPanel p, User theUser)
        {
            this.theUser = theUser;

            //set colors
            SolidColorBrush color1 = new SolidColorBrush(Color.FromArgb(179, 100, 130, 200));
            SolidColorBrush color2 = new SolidColorBrush(Color.FromArgb(255, 45, 63, 104));

            //parent -> display
            this.display = new StackPanel();
            p.Children.Add(this.display);
            this.display.Background  = color1;
            this.display.Height      = 200;
            this.display.Width       = p.Width; // set width to parent's width
            this.display.Orientation = Orientation.Horizontal;

            //parent -> display -> borderName
            DisplayNameBox borderName = new DisplayNameBox(display, color2);
            TextBlock      rowName    = (TextBlock)borderName.rowName;

            rowName.Text = "Personal Data";

            //parent -> display -> scroller
            ScrollViewer scroller = new ScrollViewer();

            this.display.Children.Add(scroller);
            scroller.VerticalScrollMode = ScrollMode.Disabled;
            scroller.ZoomMode           = ZoomMode.Disabled;
            scroller.Width  = this.display.Width - 260;
            scroller.Height = this.display.Height;
            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Disabled;

            //parent -> display -> scroller -> dataStack
            StackPanel dataStack = new StackPanel();

            scroller.Content              = dataStack;
            dataStack.Height              = 200;
            dataStack.Orientation         = Orientation.Horizontal;
            dataStack.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;

            //parent -> display -> scroller -> dataStack -> milesStack
            DisplaySliderStack milesStack = new DisplaySliderStack(dataStack,
                                                                   "How many miles do you drive a year?", "What percent are city miles (vs highway)?",
                                                                   User.MinMiles, User.MaxMiles,
                                                                   ((int)(User.MinMiles / 1000)).ToString() + "k", ((int)(User.MaxMiles / 1000)).ToString() + "k",
                                                                   (int)(User.MinPercentCity * 100), (int)(User.MaxPercentCity * 100),
                                                                   ((int)(User.MinPercentCity * 100)).ToString() + "%", ((int)(User.MaxPercentCity * 100)).ToString() + "%",
                                                                   color1, color2);
            UIElementCollection milesStackChildren = ((StackPanel)(milesStack.stackP).Children[1]).Children;

            ((Slider)milesStackChildren[1]).ValueChanged += updateMilesPerYear;
            milesStackChildren = ((StackPanel)(milesStack.stackP).Children[3]).Children;
            ((Slider)milesStackChildren[1]).ValueChanged += updatePercentCityMiles;

            //parent -> display -> scroller -> dataStack -> gasStack
            DisplaySoloSliderStack gasStack = new DisplaySoloSliderStack(dataStack,
                                                                         "How much does a gallon of gas cost?",
                                                                         (int)User.MinPriceFuel, (int)User.MaxPriceFuel,
                                                                         "$" + User.MinPriceFuel.ToString("F"), "$" + User.MaxPriceFuel.ToString("F"),
                                                                         color1, color2);
            UIElementCollection gasStackChildren = ((StackPanel)(gasStack.stackP).Children[1]).Children;

            ((Slider)gasStackChildren[1]).ValueChanged += updateGasPrice;

            //parent -> display -> scroller -> dataStack -> interestTaxStack
            DisplaySliderStack interestTaxStack = new DisplaySliderStack(dataStack,
                                                                         "What is your interest rate?", "What is your sales tax rate?",
                                                                         (int)User.MinInterest, (int)User.MaxInterest,
                                                                         ((int)(User.MinInterest)).ToString() + "%",
                                                                         ((int)(User.MaxInterest)).ToString() + "%",
                                                                         (int)User.MinTax, (int)User.MaxTax,
                                                                         ((int)(User.MinTax)).ToString() + "%",
                                                                         ((int)(User.MaxTax)).ToString() + "%",
                                                                         color1, color2);
            UIElementCollection interestTaxStackChildren = ((StackPanel)(interestTaxStack.stackP).Children[1]).Children;

            ((Slider)interestTaxStackChildren[1]).ValueChanged += updateInterest;
            interestTaxStackChildren = ((StackPanel)(interestTaxStack.stackP).Children[3]).Children;
            ((Slider)interestTaxStackChildren[1]).ValueChanged += updateTax;

            //parent -> display -> scroller -> dataStack -> deleteStack
            DisplayDeleteButton displayDeleteButton = new DisplayDeleteButton(dataStack, "Reset User Data", color2);
            Button deleteButton = displayDeleteButton.deleteB;

            deleteButton.Tapped += clearData;

            //parent -> memoBar
            this.memoBar = new StackPanel();
            p.Children.Add(this.memoBar);
            this.memoBar.Width       = p.Width; // set width to parent's width
            this.memoBar.Height      = 64;
            this.memoBar.Orientation = Orientation.Horizontal;

            //parent -> memoBar -> memoScroll -> memoStack -> elements
            DisplayMemoScroll    memoScroll       = new DisplayMemoScroll(this.memoBar);
            StackPanel           memoStack        = (StackPanel)memoScroll.memoScroll.Content;
            DisplayMemoTextBlock milesLabel       = new DisplayMemoTextBlock(memoStack, "Annual Miles:");
            DisplayMemoTextBox   miles            = new DisplayMemoTextBox(memoStack, (0.ToString()), color1);
            DisplayMemoTextBlock percentCityLabel = new DisplayMemoTextBlock(memoStack, "Percent City Miles:");
            DisplayMemoTextBox   percentCity      = new DisplayMemoTextBox(memoStack, (0.ToString()) + "%", color1);
            DisplayMemoTextBlock fuelCostLabel    = new DisplayMemoTextBlock(memoStack, "Fuel Cost:");
            DisplayMemoTextBox   fuelCost         = new DisplayMemoTextBox(memoStack, "$" + (0.ToString("F")), color1);
            DisplayMemoTextBlock interestLabel    = new DisplayMemoTextBlock(memoStack, "Interest Rate:");
            DisplayMemoTextBox   interest         = new DisplayMemoTextBox(memoStack, (0.ToString("F")) + "%", color1);
            DisplayMemoTextBlock taxLabel         = new DisplayMemoTextBlock(memoStack, "Tax Rate:");
            DisplayMemoTextBox   tax = new DisplayMemoTextBox(memoStack, (0.ToString("F")) + "%", color1);
        }