Esempio n. 1
0
        private void CreateCalendar(Size size, Point point)
        {
            // Initialize the UWP hosting environment.
            WindowsXamlManager.InitializeForCurrentThread();

            // Create a UWP control.
            CalendarDatePicker calendar = new CalendarDatePicker
            {
                Name            = "calendar",
                Width           = size.Width,
                Height          = size.Height,
                TabIndex        = 0,
                PlaceholderText = "Select Date",
                //Header = "Test Calendar"
            };

            calendar.Closed += Calendar_Closed;

            // Create a Windows XAML host control.
            WindowsXamlHost myHostControl = new WindowsXamlHost
            {
                Location = point,
                Size     = size,
                Name     = "host2",
                Child    = calendar
            };

            // Make the UWP control appear in the UI.
            // For Windows Forms applications, you might use this.Controls.Add(myHostControl);
            this.PanelContent.Controls.Add(myHostControl);
        }
Esempio n. 2
0
        private void CreateTimePicker(Size size, Point point)
        {
            WindowsXamlManager.InitializeForCurrentThread();

            TimePicker control = new TimePicker
            {
                Name     = "timePicker",
                Width    = size.Width,
                Height   = size.Height,
                TabIndex = 0
            };

            control.TimeChanged         += Control_TimeChanged;
            control.SelectedTimeChanged += Control_SelectedTimeChanged;

            WindowsXamlHost myHostControl = new WindowsXamlHost
            {
                Location = point,
                Size     = size,
                Name     = "host1",
                Child    = control
            };

            this.PanelContent.Controls.Add(myHostControl);
        }
Esempio n. 3
0
        private static void Main()
        {
            var exclusiveViewApplicationSource = new AppViewSource();

            WindowsXamlManager.InitializeForCurrentThread();
            CoreApplication.Run(exclusiveViewApplicationSource);
        }
Esempio n. 4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            WindowsXamlManager.InitializeForCurrentThread();

            base.OnStartup(e);

            // C# UWP don't work :(
            //var class1 = new Class1();
            //var hudControl = new HudControl();
        }
Esempio n. 5
0
        private void CreateTreeview(Size size, Point point)
        {
            WindowsXamlManager.InitializeForCurrentThread();

            treeView = new Windows.UI.Xaml.Controls.TreeView
            {
                Width  = size.Width,
                Height = size.Height,
            };

            List <TreeViewNode> items = new List <TreeViewNode>();

            for (int i = 0; i < 20; i++)
            {
                var item = new TreeViewNode
                {
                    Content = "Item " + i
                };
                for (int c = 0; c < 20; c++)
                {
                    item.Children.Add(new TreeViewNode
                    {
                        Content = "SubItem " + c
                    });
                }
                treeView.RootNodes.Add(item);
            }
            treeView.ItemInvoked += TreeView_ItemInvoked;

            ScrollViewer scroll = new ScrollViewer
            {
                Name    = "scroll",
                Content = treeView,
                Width   = treeView.Width,
                Height  = size.Height
            };

            try
            {
                WindowsXamlHost myHostControl = new WindowsXamlHost
                {
                    Location = point,
                    Size     = size,
                    Name     = "myHostControl",
                    Child    = scroll
                };

                this.Controls.Add(myHostControl);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 6
0
        private void CreateMap()
        {
            WindowsXamlManager.InitializeForCurrentThread();

            MapControl control = new MapControl
            {
                Name   = "map",
                Width  = PanelMap.Width,
                Height = PanelMap.Height,
                Style  = MapStyle.Road,
            };

            control.MapElements.Add(new MapIcon
            {
                Title    = "Seattle City Hall",
                Location = new Geopoint(new BasicGeoposition
                {
                    Latitude  = 47.603830,
                    Longitude = -122.329900
                })
            });
            control.Center = new Geopoint(new BasicGeoposition
            {
                Latitude  = 47.603830,
                Longitude = -122.329900
            });
            control.ZoomLevel = 10;

            WindowsXamlHost myHostControl = new WindowsXamlHost
            {
                Location = new Point(0, 0),
                Size     = new Size(PanelMap.Width, PanelMap.Height),
                Name     = "host1",
                Child    = control
            };

            this.PanelMap.Controls.Add(myHostControl);
        }
Esempio n. 7
0
        private void CreateNavigation(Size size, Point point)
        {
            WindowsXamlManager.InitializeForCurrentThread();

            navigation = new NavigationView
            {
                Width  = size.Width,
                Height = 1500,
            };

            navigation.IsSettingsVisible   = false;
            navigation.IsAccessKeyScope    = false;
            navigation.IsBackButtonVisible = NavigationViewBackButtonVisible.Collapsed;
            navigation.IsDoubleTapEnabled  = true;
            navigation.IsPaneOpen          = true;
            navigation.CanBeScrollAnchor   = true;
            navigation.DoubleTapped       += Navigation_DoubleTapped;
            navigation.ItemInvoked        += Navigation_ItemInvoked;

            navigation.IsTapEnabled = false;

            List <NavigationViewItem> items = new List <NavigationViewItem>();

            for (int i = 0; i < 20; i++)
            {
                var item = new NavigationViewItem
                {
                    Name    = "item" + i,
                    Content = "Item " + i
                };
                item.Tapped += Item_Tapped;

                if (i == 0 || i == 5 || i == 10 || i == 15 || i == 20)
                {
                    navigation.MenuItems.Add(new NavigationViewItemHeader
                    {
                        Name    = "header" + i,
                        Content = "Header " + i
                    });
                }

                navigation.MenuItems.Add(item);
            }

            ScrollViewer scroll = new ScrollViewer
            {
                Name    = "scroll",
                Content = navigation,
                Width   = navigation.Width,
                Height  = size.Height
            };

            try
            {
                WindowsXamlHost myHostControl = new WindowsXamlHost
                {
                    Location = point,
                    Size     = size,
                    Name     = "myHostControl",
                    Child    = scroll
                };

                this.Controls.Add(myHostControl);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }