Esempio n. 1
0
        private void mcChart_Loaded(object sender, RoutedEventArgs e)
        {
            EdgePanel ep = VisualHelper.FindChild <EdgePanel>(sender as Chart, "ChartArea");

            if (ep != null)
            {
                var grid = ep.Children.OfType <Grid>().FirstOrDefault();
                if (grid != null)
                {
                    grid.Background = new SolidColorBrush(Colors.Transparent);
                }

                var border = ep.Children.OfType <Border>().FirstOrDefault();
                if (border != null)
                {
                    border.BorderBrush = new SolidColorBrush(Colors.Transparent);
                }
            }

            Legend legend = VisualHelper.FindChild <Legend>(sender as Chart, "Legend");

            if (legend != null)
            {
                legend.Background  = new SolidColorBrush(Colors.Transparent);
                legend.BorderBrush = new SolidColorBrush(Colors.Transparent);
            }
        }
Esempio n. 2
0
        private static void AddItem(TokenContainerControl userControl)
        {
            var tb   = VisualHelper.FindChild <TextBox>(userControl, "MainTextBox");
            var item = tb.Text;

            if (string.IsNullOrEmpty(item))
            {
                return;
            }

            // Add token
            var currentItems = userControl.SelectedItemsCSV != null?userControl.SelectedItemsCSV.Split(',') : new string[]
            {
            };

            if (!currentItems.Contains(item))
            {
                userControl.SelectedItemsCSV = string.Join(",", currentItems.Where(x => !string.IsNullOrEmpty(x)).Union(new List <string> {
                    item
                }));
            }

            System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke((Action)(() =>
            {
                userControl.TextBoxText = string.Empty;
            }));
        }
Esempio n. 3
0
        private static void StopEdit(TokenContainerControl control)
        {
            var tb   = VisualHelper.FindChild <TextBox>(control, "MainTextBox");
            var grid = (Grid)tb.Parent;

            grid.ColumnDefinitions[0].Width = new GridLength(0);
            grid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star);
        }
Esempio n. 4
0
 private void TextBoxOnKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         AddItem(this);
         TextBoxText = string.Empty;
         var tb = VisualHelper.FindChild <TextBox>(this, "MainTextBox");
         tb.Text = string.Empty;
         StopEdit(this);
         e.Handled = true;
     }
 }
Esempio n. 5
0
        protected override void SetItemSize()
        {
            base.SetItemSize();
            var height = _frameworkElement.Width / 1.778;

            _frameworkElement.Height = height + 95;
            var border = VisualHelper.FindChild <Border>(_frameworkElement);

            if (border != null)
            {
                border.Height = height;
            }
        }
Esempio n. 6
0
        private void AssignParallax()
        {
            if (ParallaxContent == null)
            {
                return;
            }
            if (AssociatedObject == null)
            {
                return;
            }

            var scroller = AssociatedObject as ScrollViewer;

            if (scroller == null)
            {
                scroller = VisualHelper.FindChild <ScrollViewer>(AssociatedObject);
            }
            if (scroller == null)
            {
                return;
            }

            CompositionPropertySet scrollerViewerManipulation = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scroller);

            Compositor compositor = scrollerViewerManipulation.Compositor;

            ExpressionAnimation expression = compositor.CreateExpressionAnimation(ParallaxMultiplier > 0
                ? "ScrollManipulation.Translation.Y * ParallaxMultiplier - ScrollManipulation.Translation.Y"
                : "ScrollManipulation.Translation.Y * ParallaxMultiplier");

            expression.SetScalarParameter("ParallaxMultiplier", (float)ParallaxMultiplier);
            expression.SetReferenceParameter("ScrollManipulation", scrollerViewerManipulation);

            Visual textVisual = ElementCompositionPreview.GetElementVisual(ParallaxContent);

            textVisual.StartAnimation("Offset.Y", expression);
        }
        private void DataGridCell_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DataGridCell cell = sender as DataGridCell;

            Console.WriteLine($"Clicked Cell : {cell}, Name : {cell.Name}");
            ComboBox groupComboBox = VisualHelper.FindChild <ComboBox>(cell);

            if (groupComboBox != null)
            {
                return;
            }

            if (cell != null && !cell.IsEditing)
            {
                DataGridRow row = VisualHelper.FindParent <DataGridRow>(cell);
                if (row != null)
                {
                    CheckBox checkBox = VisualHelper.FindChild <CheckBox>(cell);

                    if (checkBox != null)
                    {
                        HitTestResult result = VisualTreeHelper.HitTest(checkBox, e.GetPosition(cell));

                        if (result != null)
                        {
                            // execute button and do not select / deselect row
                            checkBox.Command.Execute(row.DataContext);
                            e.Handled = true;
                            return;
                        }
                    }

                    row.IsSelected = !row.IsSelected;
                    e.Handled      = true;
                }
            }
        }
 private UIElement GetPrintableContent()
 {
     return(VisualHelper.FindChild <UIElement>(
                Window.Current.Content, "PrintableContent"));
 }