예제 #1
0
        private void CreateCropButtonsPanel()
        {
            int cropsCount = ExecutionEngine.Crops.CropFormats.Count;

            _cropButtonsGrid.Children.Clear();
            _cropButtonsGrid.ColumnDefinitions.Clear();
            _cropButtonsGrid.RowDefinitions.Clear();

            _cropButtonsGrid.ColumnDefinitions.Add(new ColumnDefinition());
            _cropButtonsGrid.ColumnDefinitions.Add(new ColumnDefinition());

            for (int i = 0; i < (cropsCount + 1) / 2; i++)
            {
                _cropButtonsGrid.RowDefinitions.Add(new RowDefinition());
            }

            for (int j = 0; j < cropsCount; j++)
            {
                RadioButton cropButton = new CropButton(ExecutionEngine.Crops.CropFormats[j], (string)TryFindResource(Constants.ImageEditorCropOptionTextKey));
                cropButton.Style  = (Style)FindResource("ImageEditorRadioButtonStyle");
                cropButton.Click += ButtonSetCropProportion;

                if (j % 2 == 0)
                {
                    cropButton.Margin = new Thickness(9, 4, 4, 4);
                }
                else
                {
                    cropButton.Margin = new Thickness(4, 4, 9, 4);
                }

                Grid.SetColumn(cropButton, j % 2);
                Grid.SetRow(cropButton, j / 2);

                _cropButtonsGrid.Children.Add(cropButton);
            }
        }
예제 #2
0
        private void ButtonSetCropProportion(object sender, RoutedEventArgs e)
        {
            CropButton cropButton = sender as CropButton;

            ShowCropUI(cropButton.CropProportion);
        }