Exemple #1
0
        /// <summary>
        /// Builds stack panel with content.
        /// </summary>
        /// <param name="selectedPage"></param>
        /// <returns></returns>
        public StackPanel BuildTaskPanelContent(ESRI.ArcLogistics.App.Pages.Page selectedPage)
        {
            StackPanel contentStackPanel = new StackPanel();

            contentStackPanel.VerticalAlignment   = VerticalAlignment.Stretch;
            contentStackPanel.HorizontalAlignment = HorizontalAlignment.Stretch;
            if (0 < selectedPage.Widgets.Count)
            {
                foreach (PageWidget widget in selectedPage.Widgets)
                {
                    // If widget contains calendar - no need to wrap it to expander, just add to Navigation pane content.
                    if (widget is CalendarWidget || widget is BarrierCalendarWidget || widget is DateRangeCalendarWidget)
                    {
                        contentStackPanel.Children.Add(widget);
                    }
                    else
                    {
                        ExpanderControl expanderControl = new ExpanderControl();
                        expanderControl.ContentOfExpander = widget;
                        expanderControl.Header            = widget.Title;
                        contentStackPanel.Children.Add(expanderControl);
                    }
                }
            }
            return(contentStackPanel);
        }
Exemple #2
0
        void TaskPanelContentBuilder_ClickButton(object sender, RoutedEventArgs e)
        {
            ExpanderControl control = sender as ExpanderControl;

            Type type = control.ContentOfExpander.GetType();

            _UpdateListOfCollapsedWidgets(type, control.IsCollapsed);
        }
Exemple #3
0
        public void TestRelativeSources()
        {
            // Self
            var entry1 = new Entry()
            {
                FontFamily     = "Courier New",
                FontSize       = 12,
                FontAttributes = FontAttributes.Italic
            };

            entry1.SetBinding(Entry.TextProperty,
                              new MultiBinding
            {
                Bindings = new Collection <BindingBase>
                {
                    new Binding(nameof(Entry.FontFamily), source: RelativeBindingSource.Self),
                    new Binding(nameof(Entry.FontSize), source: RelativeBindingSource.Self),
                    new Binding(nameof(Entry.FontAttributes), source: RelativeBindingSource.Self),
                },
                Converter = new StringConcatenationConverter()
            });
            Assert.AreEqual("Courier New 12 Italic", entry1.Text);
            // Our unit test's ConvertBack should throw an exception below because the desired
            // return types aren't all strings
            Assert.Throws <Exception>(() => entry1.SetValueCore(Entry.TextProperty, "Arial 12 Italic", Internals.SetValueFlags.None));

            // FindAncestor and FindAncestorBindingContext
            // are already tested in TestNestedMultiBindings
            TestNestedMultiBindings();

            // TemplatedParent
            var templ    = new ControlTemplate(typeof(ExpanderControlTemplate));
            var expander = new ExpanderControl
            {
                ControlTemplate = templ,
                Content         = new Label {
                    Text = "Content"
                },
                IsEnabled  = true,
                IsExpanded = true
            };
            var cp = expander.Children[0].LogicalChildren[1] as ContentPresenter;

            Assert.IsTrue(cp.IsVisible);
            expander.IsEnabled = false;
            Assert.IsFalse(cp.IsVisible);
            expander.IsEnabled = true;
            Assert.IsTrue(cp.IsVisible);
            expander.IsExpanded = false;
            Assert.IsFalse(cp.IsVisible);
        }
Exemple #4
0
        /// <summary>
        /// Toggles state of widget in panel.
        /// </summary>
        /// <param name="stackPanel">Stack panel.</param>
        /// <param name="ignoredWidgets">Ignored widget collection</param>
        /// <param name="isEnable">Enable state flag.</param>
        public void ToggleTaskPanelWidgetsState(StackPanel stackPanel, ICollection <Type> ignoredWidgets,
                                                bool isEnable)
        {
            foreach (UIElement expanderControl in stackPanel.Children)
            {
                Type type = expanderControl.GetType();
                if (type == typeof(ExpanderControl) && (null != expanderControl))
                {
                    ExpanderControl expander   = (ExpanderControl)expanderControl;
                    Type            widgetType = expander.ContentOfExpander.GetType();

                    if (!ignoredWidgets.Contains(widgetType))
                    {
                        PageWidget widget = (PageWidget)expander.ContentOfExpander;
                        widget.IsEnabled = isEnable;
                    }
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Updates state of each widget in panel.
        /// </summary>
        /// <param name="stackPanel">Stack panel.</param>
        public void UpdateTaskPanelWidgetsState(StackPanel stackPanel)
        {
            foreach (UIElement expanderControl in stackPanel.Children)
            {
                Type type = expanderControl.GetType();
                if (type == typeof(ExpanderControl) && (null != expanderControl))
                {
                    ExpanderControl expander = (ExpanderControl)expanderControl;
                    expander.ClickButton += new RoutedEventHandler(TaskPanelContentBuilder_ClickButton);

                    Type widgetType = expander.ContentOfExpander.GetType();

                    /// update collapsed state
                    expander.IsCollapsed = App.Current.MainWindow.CollapsedWidgets.Contains(widgetType);

                    if (widgetType.Equals(typeof(ESRI.ArcLogistics.App.Widgets.QuickHelpWidget)))
                    {   // quick help widget - update expander state
                        expander.Visibility = App.Current.MainWindow.IsHelpVisible ?
                                              Visibility.Visible : Visibility.Collapsed;
                    }
                }
            }
        }