Beispiel #1
0
        private void SortDirectionButton_ToggledChanged(object sender, EventArgs e)
        {
            ToolBarWideButton button = (ToolBarWideButton)sender;

            _directionButtons.Where(obj => (SortDirection)obj.HelperChild != (SortDirection)button.HelperChild)
            .ToList()
            .ForEach(obj => obj.Toggled = false);

            SortDirection = (SortDirection)button.HelperChild;
            SortDirectionChanged?.Invoke(this, EventArgs.Empty);
        }
Beispiel #2
0
        private void SortButton_ToggledChanged(object sender, EventArgs e)
        {
            ToolBarWideButton button = (ToolBarWideButton)sender;

            SortMode = (SortMode)button.HelperChild;
        }
Beispiel #3
0
        public FileSortButton()
        {
            VerticalAlignment   = VerticalAlignment.Stretch;
            HorizontalAlignment = HorizontalAlignment.Right;
            Name = "FileSortButton";

            StackPanel sortModeStackPanel = new StackPanel()
            {
                VerticalAlignment = VerticalAlignment.Stretch,
                Orientation       = Orientation.Horizontal
            };

            Image sortingImage = new Image()
            {
                Width  = 18,
                Height = 18,
                Margin = new Thickness(0, 11, 10, 11),
                Source = ImageHelper.UriToImageSource(new Uri(@"pack://application:,,,/resources/sorting_blue.png"))
            };

            RenderOptions.SetBitmapScalingMode(sortingImage, BitmapScalingMode.HighQuality);

            ToolBarWideButton nameSortButton = new ToolBarWideButton("Nazwa", null, true);

            nameSortButton.ToggledChanged += SortButton_ToggledChanged;
            nameSortButton.HelperChild     = SortMode.NameSort;

            ToolBarWideButton typeSortButton = new ToolBarWideButton("Typ", null, true);

            typeSortButton.ToggledChanged += SortButton_ToggledChanged;
            typeSortButton.HelperChild     = SortMode.TypeSort;

            ToolBarWideButton dateSortButton = new ToolBarWideButton("Data", null, true);

            dateSortButton.ToggledChanged += SortButton_ToggledChanged;
            dateSortButton.HelperChild     = SortMode.DateSort;

            ToolBarSpacer spacer = new ToolBarSpacer(0.6, new Thickness(5, 8, 5, 8));

            ToolBarWideButton ascendingSortButton = new ToolBarWideButton("Rosnąco", null, true);

            ascendingSortButton.ToggledChanged += SortDirectionButton_ToggledChanged;
            ascendingSortButton.HelperChild     = SortDirection.Ascending;

            ToolBarWideButton descendingSortButton = new ToolBarWideButton("Malejąco", null, true);

            descendingSortButton.ToggledChanged += SortDirectionButton_ToggledChanged;
            descendingSortButton.HelperChild     = SortDirection.Descending;

            sortModeStackPanel.Children.Add(sortingImage);
            sortModeStackPanel.Children.Add(nameSortButton);
            sortModeStackPanel.Children.Add(typeSortButton);
            sortModeStackPanel.Children.Add(dateSortButton);
            sortModeStackPanel.Children.Add(spacer);
            sortModeStackPanel.Children.Add(ascendingSortButton);
            sortModeStackPanel.Children.Add(descendingSortButton);

            _sortButtons.Add(nameSortButton);
            _sortButtons.Add(typeSortButton);
            _sortButtons.Add(dateSortButton);

            _directionButtons.Add(ascendingSortButton);
            _directionButtons.Add(descendingSortButton);

            DockPanel.SetDock(sortModeStackPanel, Dock.Left);
            Children.Add(sortModeStackPanel);

            SortMode = SortMode.NameSort;
        }