예제 #1
0
        private UIElement FiltersGroupHeaderToStackPanel(KeyValuePair <IFilter, int> group)
        {
            var resultStackPanel = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Thickness(0, 0, 0, 5),
                Height      = RefHeight,
            };

            var checkbox = new CheckBoxWithObject
            {
                Object            = group,
                Content           = group.Value.ToString(),
                VerticalAlignment = VerticalAlignment.Center,
            };

            checkbox.Checked   += Checkbox_Checked;
            checkbox.Unchecked += Checkbox_Unchecked;
            var border = CreateBorderWithLabel(((FiltersGroup)group.Key).Name);

            _checkboxes.Add(checkbox);

            resultStackPanel.Children.Add(checkbox);
            resultStackPanel.Children.Add(border);

            return(resultStackPanel);
        }
예제 #2
0
        private UIElement GroupHeaderToStackPanel(FiltersGroup group)
        {
            var resultStackPanel = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Thickness(0, 0, 0, 5),
                Height      = RefHeight + 3,
            };

            var checkbox = new CheckBoxWithObject
            {
                Object                     = group,
                VerticalAlignment          = VerticalAlignment.Top,
                Height                     = 20,
                Width                      = 20,
                VerticalContentAlignment   = VerticalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Right,
                IsChecked                  = group.Visibility,
            };

            checkbox.Checked   += Checkbox_Changed;
            checkbox.Unchecked += Checkbox_Changed;

            var button = new ButtonWithObject
            {
                Style   = (Style)FindResource("MyButton"),
                Content = new Image
                {
                    Source              = new BitmapImage(new Uri(@"..\img\edit-icon.png", UriKind.Relative)),
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                },
                Height              = 20,
                Width               = 20,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Object              = group,
            };

            button.Click += OpenEditMode;

            var button2 = new ButtonWithObject
            {
                Style   = (Style)FindResource("MyButton"),
                Content = new Image
                {
                    Source              = new BitmapImage(new Uri(@"..\img\x-icon.png", UriKind.Relative)),
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                },
                Height              = 20,
                Width               = 20,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Object              = group,
            };

            button2.Click += RemoveGroup;

            resultStackPanel.Children.Add(button2);
            resultStackPanel.Children.Add(button);
            resultStackPanel.Children.Add(checkbox);

            var borderDescription = CreateBorderWithLabel($"{group.Name}");

            resultStackPanel.Children.Add(borderDescription);

            return(resultStackPanel);
        }