Ejemplo n.º 1
0
        public ShellSectionRenderer()
        {
            Microsoft.Maui.Controls.Shell.VerifyShellUWPFlagEnabled(nameof(ShellSectionRenderer));
            MenuItemTemplate      = (Microsoft.UI.Xaml.DataTemplate)Microsoft.UI.Xaml.Application.Current.Resources["ShellSectionMenuItemTemplate"];
            IsBackButtonVisible   = Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible.Collapsed;
            IsSettingsVisible     = false;
            AlwaysShowHeader      = false;
            PaneDisplayMode       = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Top;
            ItemInvoked          += OnMenuItemInvoked;
            ShellContentMenuItems = new ObservableCollection <ShellContent>();
            MenuItemsSource       = ShellContentMenuItems;
            AutoSuggestBox        = new Microsoft.UI.Xaml.Controls.AutoSuggestBox()
            {
                Width = 300
            };
            AutoSuggestBox.TextChanged      += OnSearchBoxTextChanged;
            AutoSuggestBox.QuerySubmitted   += OnSearchBoxQuerySubmitted;
            AutoSuggestBox.SuggestionChosen += OnSearchBoxSuggestionChosen;

            Frame             = new Microsoft.UI.Xaml.Controls.Frame();
            Content           = Frame;
            this.SizeChanged += OnShellSectionRendererSizeChanged;
            Resources["NavigationViewTopPaneBackground"]            = new Microsoft.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultBackgroundColor);
            Resources["TopNavigationViewItemForeground"]            = new Microsoft.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["TopNavigationViewItemForegroundSelected"]    = new Microsoft.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["NavigationViewSelectionIndicatorForeground"] = new Microsoft.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            FormsNavigationStack = new List <Page>();
        }
Ejemplo n.º 2
0
		WBrush GetBarBackgroundBrush()
		{
			object defaultColor = new WSolidColorBrush(Microsoft.UI.Colors.Transparent);

			if (Element.BarBackgroundColor.IsDefault() && defaultColor != null)
				return (WBrush)defaultColor;
			return Element.BarBackgroundColor.ToNative();
		}
Ejemplo n.º 3
0
        public static WBrush?CreateBrush(this SolidPaint solidPaint)
        {
            var brush = new WSolidColorBrush
            {
                Color = solidPaint.Color.ToWindowsColor()
            };

            return(brush);
        }
Ejemplo n.º 4
0
        WBrush GetBarBackgroundBrush()
        {
            object defaultColor = new WSolidColorBrush(Microsoft.UI.Colors.Transparent);

            if (Element.BarBackgroundColor.IsDefault() && defaultColor != null)
            {
                return((WBrush)defaultColor);
            }
            return(Element.BarBackgroundColor.ToPlatform());
        }
Ejemplo n.º 5
0
        void UpdateIndicatorsColor()
        {
            if (!(Control is ItemsControl))
            {
                return;
            }

            _fillColor     = new WSolidColorBrush(Element.IndicatorColor.ToWindowsColor());
            _selectedColor = new WSolidColorBrush(Element.SelectedIndicatorColor.ToWindowsColor());
            var position = Element.Position;
            int i        = 0;

            foreach (var item in (Control as ItemsControl).Items)
            {
                ((WShape)item).Fill = i == position ? _selectedColor : _fillColor;
                i++;
            }
        }
Ejemplo n.º 6
0
        protected override void OnElementChanged(ElementChangedEventArgs <IndicatorView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                if (Control == null)
                {
                    UpdateControl();
                }

                _fillColor = new WSolidColorBrush(Element.IndicatorColor.ToWindowsColor());

                _selectedColor = new WSolidColorBrush(Element.SelectedIndicatorColor.ToWindowsColor());

                CreateIndicators();
            }
        }
Ejemplo n.º 7
0
 public static Color ToFormsColor(this WSolidColorBrush solidColorBrush)
 {
     return(solidColorBrush.Color.ToFormsColor());
 }
Ejemplo n.º 8
0
 public static Graphics.Color ToColor(this WSolidColorBrush solidColorBrush)
 {
     return(solidColorBrush.Color.ToColor());
 }