Inheritance: Control, IContentControl, IContentControlOverrides
Esempio n. 1
0
        protected override void OnApplyTemplate() {
            base.OnApplyTemplate();
            ContentPresenter = (ContentControl)GetTemplateChild("ContentPresenter");
            planeProjection = (PlaneProjection)GetTemplateChild("Rotator");
            LayoutRoot = (FrameworkElement)GetTemplateChild("LayoutRoot");

            Animation = (Storyboard)GetTemplateChild("Animation");
            Animation.Completed += Animation_Completed;

            rotationKeyFrame = (EasingDoubleKeyFrame)GetTemplateChild("rotationKeyFrame");
            offestZKeyFrame = (EasingDoubleKeyFrame)GetTemplateChild("offestZKeyFrame");
            scaleXKeyFrame = (EasingDoubleKeyFrame)GetTemplateChild("scaleXKeyFrame");
            scaleYKeyFrame = (EasingDoubleKeyFrame)GetTemplateChild("scaleYKeyFrame");
            scaleTransform = (ScaleTransform)GetTemplateChild("scaleTransform");

            planeProjection.RotationY = yRotation;
            planeProjection.LocalOffsetZ = zOffset;

            if (ContentPresenter != null) {
                ContentPresenter.Tapped += ContentPresenter_Tapped;
            }

            if (Animation != null) {
                xAnimation = new DoubleAnimation();
                Animation.Children.Add(xAnimation);
                Storyboard.SetTarget(xAnimation, this);
                Storyboard.SetTargetProperty(xAnimation, "(Canvas.Left)");
            }
        }
        public async Task AdapterAssociatesSelectorWithRegionActiveViews()
        {
            await ExecuteOnUIThread(() =>
                {
                    var control = new ContentControl();
                    IRegionAdapter adapter = new TestableContentControlRegionAdapter();

                    MockPresentationRegion region = (MockPresentationRegion)adapter.Initialize(control, "Region1");
                    Assert.IsNotNull(region);

                    Assert.IsNull(control.Content);
                    region.MockActiveViews.Items.Add(new object());

                    Assert.IsNotNull(control.Content);
                    Assert.AreSame(control.Content, region.ActiveViews.ElementAt(0));

                    region.MockActiveViews.Items.Add(new object());
                    Assert.AreSame(control.Content, region.ActiveViews.ElementAt(0));

                    region.MockActiveViews.Items.RemoveAt(0);
                    Assert.AreSame(control.Content, region.ActiveViews.ElementAt(0));

                    region.MockActiveViews.Items.RemoveAt(0);
                    Assert.IsNull(control.Content);
                });
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://wikipediaquerytoolxaml/Files/SplitPage.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");
            PortraitDetail = (Windows.UI.Xaml.VisualState)this.FindName("PortraitDetail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            SnappedDetail = (Windows.UI.Xaml.VisualState)this.FindName("SnappedDetail");
            PrimaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("PrimaryColumn");
            TitlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("TitlePanel");
            ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView");
            ItemDetail = (Windows.UI.Xaml.Controls.ContentControl)this.FindName("ItemDetail");
            ItemStackPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("ItemStackPanel");
            BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton");
            PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle");
        }
Esempio n. 4
0
		public void UpdateItemDetails()
		{
			if (DataGrid.ItemDetailsTemplate != null)
			{
				if (!isSelected || !DataGrid.ShowItemDetails)
				{
					if (detailsControl != null)
					{
						Children.Remove(detailsControl);
						detailsControl = null;
					}
				}
				else if (isSelected && DataGrid.ShowItemDetails)
				{
					if (detailsControl == null)
					{
						detailsControl = new ContentControl();
						detailsControl.Content = Item;
						detailsControl.ContentTemplate = DataGrid.ItemDetailsTemplate;
						detailsControl.VerticalContentAlignment = VerticalAlignment.Stretch;
						detailsControl.HorizontalContentAlignment = HorizontalAlignment.Stretch;

						Children.Add(detailsControl);
						SetRow(detailsControl, 1);
						SetColumnSpan(detailsControl, ColumnDefinitions.Count);
					}
					else
						detailsControl.ContentTemplate = DataGrid.ItemDetailsTemplate;
				}
			}

			foreach (var cell in Cells)
				cell.OnSelectedChanged(isSelected);
		}
        /// <summary>
        /// Returns the child window to display as part of the trigger action.
        /// </summary>
        /// <param name="notification">The notification to display in the child window.</param>
        /// <returns></returns>
        protected override MessageDialog GetMessageDialog(INotification notification)
        {
            var childWindow = this.MessageDialog ?? this.CreateDefaultWindow(notification);
            var contentControl = new ContentControl();
            childWindow.DataContext = notification;

            return childWindow;
        }
Esempio n. 6
0
        public void Init(ContentControl contentFrame1, ContentControl contentFrame2)
        {

            _contentFrame1 = contentFrame1;
            _contentFrame2 = contentFrame2;
            
            _contentFrame1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            _contentFrame2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
        }
Esempio n. 7
0
        protected override void OnApplyTemplate()
        {
            _rootGrid = GetTemplateChild(PART_ROOT_NAME) as Grid;
            _grabberGrid = GetTemplateChild(PART_GRABBER_NAME) as Grid;
            _contentPresenter = GetTemplateChild(PART_CONTENT_NAME) as ContentControl;
            _thumb = GetTemplateChild(PART_THUMB_NAME) as Thumb;

            InitEvents();
        }
		public void OnApplyTemplate()
		{
			base.OnApplyTemplate();
			this.WatermarkContent = this.GetTemplateChild("watermarkContent") as ContentControl;
			if (WatermarkContent != null)
			{
				DetermineWatermarkContentVisibility();
			}
		}
Esempio n. 9
0
 private void AddEnemy()
 {
     ContentControl enemy = new ContentControl();
     enemy.Template = Resources["EnemyTemplate"] as ControlTemplate;
     AnimateEnemy(enemy, 0, playArea.ActualWidth - 100, "(Canvas.Left)");
     AnimateEnemy(enemy, random.Next((int)playArea.ActualHeight - 100),
         random.Next((int)playArea.ActualHeight - 100), "(Canvas.Top)");
     playArea.Children.Add(enemy);
 }
Esempio n. 10
0
        public static void Start(ContentControl f12panel) {
            if (F12toolsInstance == null) F12toolsInstance = new F12Tools(f12panel);


            F12toolsInstance.F12Panel.Content = new ConsoleUI();
            F12toolsInstance.F12Panel.Visibility = Windows.UI.Xaml.Visibility.Visible;

            IsStarted = true;
        }
		public override DataGridCell GenerateElement(object dataItem)
		{
			var control = new ContentControl();
			control.HorizontalContentAlignment = HorizontalAlignment.Stretch;
			control.VerticalContentAlignment = VerticalAlignment.Stretch;
			control.Content = dataItem;
			control.ContentTemplate = cellTemplate;

			if (OnlyVisibleOnSelection)
				control.Visibility = IsSelected ? Visibility.Visible : Visibility.Collapsed; 
			return new DataGridTemplatedCell(control, OnlyVisibleOnSelection);
		}
        public async Task ControlWithExistingContentThrows()
        {
            await ExecuteOnUIThread(() =>
                {
                    var control = new ContentControl() { Content = new object() };

                    IRegionAdapter adapter = new TestableContentControlRegionAdapter();

                    Assert.ThrowsException<InvalidOperationException>(
                        () => (MockPresentationRegion)adapter.Initialize(control, "Region1"),
                        "ContentControl's Content property is not empty.");
                });
        }
        protected override bool GoToStateCore(Control control, FrameworkElement stateGroupsRoot, string stateName, VisualStateGroup group, VisualState state, bool useTransitions)
        {
            if ((group == null) || (state == null))
            {
                return false;
            }

            if (control == null)
            {
                control = new ContentControl();
            }

            return base.GoToStateCore(control, stateGroupsRoot, stateName, group, state, useTransitions);
        }
Esempio n. 14
0
 private void AnimateEnemy(ContentControl enemy, double from, double to, string propertyToAnimate)
 {
     Storyboard storyboard = new Storyboard() { AutoReverse = true, RepeatBehavior = RepeatBehavior.Forever };
     DoubleAnimation animation = new DoubleAnimation()
     {
         From = from,
         To = to,
         Duration = new Duration(TimeSpan.FromSeconds(random.Next(4, 6)))
     };
     Storyboard.SetTarget(animation, enemy);
     Storyboard.SetTargetProperty(animation, propertyToAnimate);
     storyboard.Children.Add(animation);
     storyboard.Begin();
 }
Esempio n. 15
0
        protected override void OnApplyTemplate()
        {
            _splitView = base.GetTemplateChild("splitView") as SplitView;
            _toggle = base.GetTemplateChild("toggle") as Button;
            _exitFS = base.GetTemplateChild("exitFS") as Button;
            _headerContainer = base.GetTemplateChild("headerContainer") as Panel;
            _commandBarContainer = base.GetTemplateChild("commandBarContainer") as ContentControl;
            _paneHeaderContainer = base.GetTemplateChild("paneHeaderContainer") as ContentControl;
            _lview = base.GetTemplateChild("lview") as ListView;
            _lviewSub = base.GetTemplateChild("lviewSub") as ListView;
            _container = base.GetTemplateChild("container") as Panel;
            _content = base.GetTemplateChild("content") as Panel;

            _topPane = base.GetTemplateChild("topPane") as ContentControl;
            _rightPane = base.GetTemplateChild("rightPane") as ContentControl;

            if (ListViewItemContainerStyle != null)
            {
                _lview.ItemContainerStyleSelector = new NavigationStyleSelector(ListViewItemContainerStyle, this.SeparatorStyle);
                _lviewSub.ItemContainerStyleSelector = new NavigationStyleSelector(ListViewItemContainerStyle, this.SeparatorStyle);
            }
            else
            {
                _lview.ItemContainerStyleSelector = new NavigationStyleSelector(_lview.ItemContainerStyle, this.SeparatorStyle);
                _lviewSub.ItemContainerStyleSelector = new NavigationStyleSelector(_lview.ItemContainerStyle, this.SeparatorStyle);
            }            
            _lview.ItemContainerStyle = null;            
            _lviewSub.ItemContainerStyle = null;

            _toggle.Click += OnToggleClick;
            _exitFS.Click += OnExitFSClick;
            _splitView.PaneClosed += OnPaneClosed;
            _lview.ItemClick += OnItemClick;
            _lviewSub.ItemClick += OnItemClick;
            _lview.SelectionChanged += OnSelectionChanged;

            _isInitialized = true;

            this.SelectFirstNavigationItem();

            SetDisplayMode(this.DisplayMode);
            SetCommandBar(_commandBar);
            SetCommandBarVerticalAlignment(this.CommandBarVerticalAlignment);
            SetPaneHeader(_paneHeader);

            base.OnApplyTemplate();
        }
Esempio n. 16
0
        protected override void Initialize()
        {
#if TODO_XAML
            content = new swc.DockPanel();
#else
            content = new Panel();
#endif
            base.Initialize();
            Control.SizeToContent       = sw.SizeToContent.WidthAndHeight;
            Control.SnapsToDevicePixels = true;
            Control.UseLayoutRounding   = true;
#if TODO_XAML
            main = new swc.DockPanel();
#endif
            menuHolder = new swc.ContentControl {
                IsTabStop = false
            };
            toolBarHolder = new swc.ContentControl {
                IsTabStop = false
            };
            content.Background = Windows.UI.Xaml.SystemColors.ControlBrush;
            swc.DockPanel.SetDock(menuHolder, swc.Dock.Top);
            swc.DockPanel.SetDock(toolBarHolder, swc.Dock.Top);
#if TODO_XAML
            main.Children.Add(menuHolder);
            main.Children.Add(toolBarHolder);
            main.Children.Add(content);
            Control.Content = main;
#endif
            Control.Loaded += delegate
            {
                SetResizeMode();
                if (initialClientSize != null)
                {
                    initialClientSize = null;
                    SetContentSize();
                }
                // stop form from auto-sizing after it is shown
                Control.SizeToContent = sw.SizeToContent.Manual;
                Control.MoveFocus(new swi.TraversalRequest(swi.FocusNavigationDirection.Next));
            };
            // needed to handle Application.Terminating event
            HandleEvent(Window.ClosingEvent);
        }
        public FullWindowPopup()
        {
            _contentControl = new ContentControl()
            {
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalContentAlignment = VerticalAlignment.Stretch
            };

            _popup = new Popup()
            {
                Child = _contentControl
            };
            var binding = new Binding()
            {
                Source = this,
                Path = new PropertyPath(nameof(IsOpen)),
                Mode = BindingMode.TwoWay
            };
            _popup.SetBinding(Popup.IsOpenProperty, binding);

            Action keepPopupSize = () =>
            {
                Window.Current.SizeChanged += delegate
                {
                    ReSize();
                };
                ReSize();
            };

            var app = Bootstrapper.Current;
            if (app != null && app.IsInConstructing)
            {
                // 应用程序的 App 类继承自 Bootstrapper,并且当前处于 App 类的构造函数中,将保持 Popup 大小的方法放至构造函数执行完成后再执行。
                app._waitForConstructedActions.Add(() =>
                {
                    keepPopupSize.Invoke();
                    return Task.FromResult<object>(null);
                });
            }
            else
            {
                keepPopupSize.Invoke();
            }
        }
        public async Task ControlWithExistingBindingOnContentWithNullValueThrows()
        {
            await ExecuteOnUIThread(() =>
                {
                    var control = new ContentControl();
                    Binding binding = new Binding
                    {
                        Path = new PropertyPath("ObjectContents"),
                        Source = new SimpleModel() { ObjectContents = null }
                    };
                    control.SetBinding(ContentControl.ContentProperty, binding);

                    IRegionAdapter adapter = new TestableContentControlRegionAdapter();

                    Assert.ThrowsException<InvalidOperationException>(
                        () => (MockPresentationRegion)adapter.Initialize(control, "Region1"),
                        "ContentControl's Content property is not empty.");
                });
        }
        protected override void OnApplyTemplate()
        {
            var rootLayout = (FrameworkElement)GetTemplateChild("RootLayout");

            // 实际内容容器。
            _contentBorder = (ContentControl)GetTemplateChild("ContentBorder");

            // 倒影图片。
            _reflectionImage = (Image)GetTemplateChild("ReflectionImage");

            // 倒影位移。
            _spacingTransform = (TranslateTransform)GetTemplateChild("SpacingTransform");
            _spacingTransform.Y = ReflectionSpacing;

            if (DesignMode.DesignModeEnabled == false)
            {
                rootLayout.LayoutUpdated += RootLayoutChanged;
            }
        }
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            firstContentPresenter = GetTemplateChild("FirstContentPresenter") as ContentControl;
            if (firstContentPresenter != null)
                appFrame = firstContentPresenter.Content as Frame;

            loadMenuAndBar(true);
            appFrame.Navigated += (sender, e) => loadMenuAndBar();

            topBar = GetTemplateChild("TopBar") as ContentControl;
            topBarGrid = GetTemplateChild("TopBarGrid") as Grid;
            menu = GetTemplateChild("Menu") as ContentControl;

            menuButton = GetTemplateChild("MenuButton") as Border;
            menuButton.Tapped += (sender, e) =>
            {
                if (isMenuOpened)
                    CloseMenu();
                else
                    OpenMenu();
            };

            mainGrid = GetTemplateChild("MainGrid") as Grid;

            var view = ApplicationView.GetForCurrentView();
            if (view != null && view.DesiredBoundsMode != ApplicationViewBoundsMode.UseCoreWindow)
                view.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);

            var statusBar = StatusBar.GetForCurrentView();
            if (statusBar != null)
            {
                statusBar.BackgroundColor = new Color() { R = 0, G = 0, B = 0 };
                statusBar.ForegroundColor = new Color() { R = 255, G = 255, B = 255 };
                statusBar.BackgroundOpacity = 0;
            }

            gestureHandler();

            DisplayInformation.GetForCurrentView().OrientationChanged += FrameContainer_OrientationChanged;
        }
Esempio n. 21
0
        private void scrollViewer_Loaded(object sender, RoutedEventArgs e)
        {
            scrollViewer.Loaded -= scrollViewer_Loaded;
            scrollViewer.ViewChanged += ScrollViewer_ViewChanged;

            currentTopGroupHeader = this.scrollViewer.FindDescendantByName("TopGroupHeader") as ContentControl;
            Binding binding = new Binding();
            binding.Source = this;
            binding.Mode = BindingMode.OneWay;
            binding.Path = new PropertyPath("GroupHeaderTemplate");
            currentTopGroupHeader.SetBinding(ContentControl.ContentTemplateProperty, binding);
            currentTopGroupHeader.Visibility = Visibility.Collapsed;
            if (scrollViewer.VerticalOffset == 0)
            {
                CreateVisual();
            }
            else
            {
                scrollViewer.RegisterPropertyChangedCallback(ScrollViewer.VerticalOffsetProperty, new DependencyPropertyChangedCallback(OnScrollViewerVerticalOffsetChanged));
            }
        }
Esempio n. 22
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _content = GetTemplateChild(ContentName) as Grid;
            _pane = GetTemplateChild(PaneName) as ContentControl;
            _menuIcon = GetTemplateChild(MenuIconName) as TextBlock;
            _hidePane = GetTemplateChild(HidePaneName) as Storyboard;
            _showPane = GetTemplateChild(ShowPaneName) as Storyboard;
            _hidePaneAnimation = GetTemplateChild(HidePaneAnimationName) as DoubleAnimation;
            _showPaneAnimation = GetTemplateChild(ShowPaneAnimationName) as DoubleAnimation;
            _showPaneContentAnimation = GetTemplateChild(ShowPaneContentAnimationName) as DoubleAnimation;

            this.Unloaded += SplitView_Unloaded;
            _pane.SizeChanged += leftPane_SizeChanged;
            _menuIcon.Tapped += _menuIcon_Tapped;
            
            ManipulationMode = ManipulationModes.TranslateX;
            ManipulationDelta += SplitView_ManipulationDelta;
            ManipulationCompleted += SplitView_ManipulationCompleted;
        }
Esempio n. 23
0
 public Popup Create(PopupSize size, UIElement content = null)
 {
     var container = new ContentControl
     {
         HorizontalContentAlignment = HorizontalAlignment.Stretch,
         VerticalContentAlignment = VerticalAlignment.Stretch,
         Height = Window.Current.Bounds.Height,
         Width = Window.Current.Bounds.Width,
         Content = content,
     };
     var popup = new Popup
     {
         Child = container,
         HorizontalOffset = 0,
         VerticalOffset = 0,
     };
     WindowSizeChangedEventHandler handler = (s, e) =>
     {
         if (popup.IsOpen)
         {
             container.Height = e.Size.Height;
             container.Width = e.Size.Width;
         }
     };
     if (size == PopupSize.FullScreen)
     {
         popup.RegisterPropertyChangedCallback(Popup.IsOpenProperty, (d, e) =>
         {
             if (popup.IsOpen)
             {
                 Window.Current.SizeChanged += handler;
             }
             else
             {
                 Window.Current.SizeChanged -= handler;
             }
         });
     }
     return popup;
 }
        protected virtual void SetWindowContent(object page)
        {
            // If the content host has not been created then create this

            if (_contentHost == null)
            {
                _contentHost = new ContentControl()
                {
                    HorizontalContentAlignment = HorizontalAlignment.Stretch,
                    VerticalContentAlignment = VerticalAlignment.Stretch
                };
            }

            // Ensure that the window content is set to the content host

            if (Window.Current.Content != _contentHost)
                Window.Current.Content = _contentHost;

            // Set the content to display

            _contentHost.Content = page;
        }
Esempio n. 25
0
        // *** Methods ***

        public void NavigateTo(object page)
        {
            // If the content host has not been created then create this

            if (contentHost == null)
            {
                contentHost = new ContentControl()
                                {
                                    HorizontalContentAlignment = HorizontalAlignment.Stretch,
                                    VerticalContentAlignment = VerticalAlignment.Stretch
                                };
            }

            // Ensure that the window content is set to the content host

            if (Window.Current.Content != contentHost)
                Window.Current.Content = contentHost;

            // Set the content to display

            contentHost.Content = page;
        }
        // Reverse geocode the clicked point and add a graphic and map tip to the map
        private async void MyMapView_MapViewTapped(object sender, MapViewInputEventArgs e)
        {
            try
            {
                _graphicsOverlay.Graphics.Add(new Graphic(e.Location));

                var result = await _locator.ReverseGeocodeAsync(e.Location, 50, SpatialReferences.Wgs84, CancellationToken.None);

                var overlay = new ContentControl() { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top };
                overlay.Template = layoutGrid.Resources["MapTipTemplate"] as ControlTemplate;
                overlay.DataContext = result;
				MapView.SetViewOverlayAnchor(overlay, e.Location);
                MyMapView.Overlays.Items.Add(overlay);
            }
            catch (AggregateException aex)
            {
                var _x = new MessageDialog(aex.InnerExceptions[0].Message, "Reverse Geocode").ShowAsync();
            }
            catch (Exception ex)
            {
                var _x = new MessageDialog(ex.Message, "Reverse Geocode").ShowAsync();
            }
        }
Esempio n. 27
0
        private void oneTimeInit()
        {
            if (hasInitialized) return;

            //if(_bkgLayer == null) _bkgLayer = GetTemplateChild("bkgLayer") as EffectLayer.EffectLayer;

            if (_root == null) _root = GetTemplateChild("root") as Grid;

            if (_root != null) {
                if (_ccTitle == null) { _ccTitle = GetTemplateChild("ccTitle") as ContentControl; _ccTitle.Content = TitleContent; }
                if (_recSmallTitle == null)
                {
                    _recSmallTitle = GetTemplateChild("recSmallTitle") as Windows.UI.Xaml.Shapes.Rectangle;
                    Window.Current.SetTitleBar(_recSmallTitle);

                    //_dtChrome = new DispatcherTimer();
                    //_dtChrome.Interval = new TimeSpan(0, 0, 0, 0, 15);
                    //_dtChrome.Tick += (object sender, object e) =>
                    //{
                    //    //NativeLib.GetCursorPos(ref _curPos);
                    //    //ChromeUpdate(_curPos);
                    //};
                    //if (EnableResizeFix) _dtChrome.Start();
                    //else _dtChrome.Stop();
                }

                if (_tbTitle == null)
                {
                    _tbTitle = GetTemplateChild("tbTitle") as TextBlock;
                    _tbTitle.DataContext = this;
                }

                //if (_bkgLayer != null && _tbTitle != null && _tbTitle.ActualWidth != 0) _bkgLayer.InitLayer(_root.ActualWidth, _root.ActualHeight, bkgOffsetX, bkgOffsetY);

            }
            if (_root != null) hasInitialized = true;
        }
Esempio n. 28
0
File: Shell.cs Progetto: liquidboy/X
        private void oneTimeInit() {
            if (hasInitialized) return;

            if (_root == null) _root = GetTemplateChild("root") as Grid;
            
            if (_root != null) {
                if (_mainContent == null) _mainContent = GetTemplateChild("grdMainContent") as ContentControl;
                if (_ctlBarBottom == null) _ctlBarBottom = GetTemplateChild("ctlExtensionsBarBottom") as ContentControl;
                if (_ctlBarTop == null) _ctlBarTop = GetTemplateChild("ctlExtensionsBarTop") as ContentControl;
                if (_ctlBarLeft == null) _ctlBarLeft = GetTemplateChild("ctlExtensionsBarLeft") as ContentControl;
                if (_ctlBarRight == null) _ctlBarRight = GetTemplateChild("ctlExtensionsBarRight") as ContentControl;
                if (_ctlOneBox == null) _ctlOneBox = GetTemplateChild("ctlOneBox") as ContentControl;
                

                if (DockedExtensionBottomFull == null) DockedExtensionBottomFull = GetTemplateChild("grdDockedExtensionBottomFull") as StackPanel;
                if (DockedExtensionLeft == null) DockedExtensionLeft = GetTemplateChild("grdDockedExtensionLeft") as StackPanel;
                if (DockedExtensionRight == null) DockedExtensionRight = GetTemplateChild("grdDockedExtensionRight") as StackPanel;
                if (DockedExtensionTopFull == null) DockedExtensionTopFull = GetTemplateChild("grdDockedExtensionTopFull") as StackPanel;
                if (DockedExtensionBottom == null) DockedExtensionBottom = GetTemplateChild("grdDockedExtensionBottom") as StackPanel;
                if (DockedExtensionTop == null) DockedExtensionTop = GetTemplateChild("grdDockedExtensionTop") as StackPanel;
            }
            
            if (_root != null) hasInitialized = true;
        }
        public SquareOfSquares()
        {
            this.InitializeComponent();

            Root.RowDefinitions.Clear();
            Root.RowDefinitions.Clear();

            for (int i = 0; i < 112; i++)
            {
                Root.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
                Root.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
            }

            foreach (InnerSquare square in GetSquares())
            {
                var ctl = new ContentControl();
                ctl.SetValue(Grid.RowProperty, square.Position.Y);
                ctl.SetValue(Grid.ColumnProperty, square.Position.X);
                ctl.SetValue(Grid.ColumnSpanProperty, square.Side);
                ctl.SetValue(Grid.RowSpanProperty, square.Side);
                Root.Children.Add(ctl);
                Squares.Add(ctl);
            }
        }
Esempio n. 30
0
		protected async override void OnApplyTemplate()
		{
			base.OnApplyTemplate();

			list = (ExtendedListBox)GetTemplateChild("List");
			content = (ContentControl)GetTemplateChild("Content");

			list.ItemsSource = Items;
			list.SelectionChanged += OnSelectionChanged;
			if (initialItem != null)
				list.SelectedItem = initialItem;
			else
				list.SelectedIndex = initialIndex;

			if (PreloadPivots)
			{
				foreach (var item in Items)
				{
					content.Content = item.Content;
					await Task.Yield(); // TODO find better solution (evtl. hidden content presenter?)
				}
				content.Content = ((PivotItem)list.SelectedItem).Content;
			}
		}
        private async Task CloseAsync()
        {
            if (!_shown)
            {
                throw new InvalidOperationException("The dialog isn't shown, so it can't be closed.");
            }

            await this.GoToVisualStateAsync(_layoutRoot, PopupStatesGroupName, ClosedPopupStateName);
            _dialogPopup.IsOpen = false;
            _buttonsPanel.Children.Clear();

            foreach (var button in _buttons)
            {
                button.Click -= OnButtonClick;
                button.KeyUp -= OnGlobalKeyUp;
            }

            _buttons.Clear();

            _dialogPopup.Child = null;

            if (_parentPanel != null)
            {
                _parentPanel.Children.Remove(_dialogPopup);
                _parentPanel.Children.Add(this);
                _parentPanel.SizeChanged -= OnParentSizeChanged;
                _parentPanel = null;
            }

            if (_parentContentControl != null)
            {
                _parentContentControl.Content = this;
                _parentContentControl.SizeChanged -= OnParentSizeChanged;
                _parentContentControl = null;
            }

            if (_temporaryParentPanel != null)
            {
                _temporaryParentPanel.Children.Remove(_dialogPopup);
                _temporaryParentPanel.SizeChanged -= OnParentSizeChanged;
                _temporaryParentPanel = null;
            }

            _dialogPopup = null;
            this.Visibility = Visibility.Collapsed;
            _shown = false;
        }
Esempio n. 32
0
 public UnoViewHolder(ContentControl itemView) : base(itemView)
 {
 }