public CropButton(CropFormat cropStruct, string cropTitle) { if (cropStruct.Width < 0 || cropStruct.Height <= 0) { _cropProportion = 0; } else { _cropProportion = (double)cropStruct.Width / (double)cropStruct.Height; } Style = (Style)FindResource("ImageEditorRadioButtonStyle"); Width = 100; Height = 70; Margin = new Thickness(9, 11, 9, 11); StackPanel panel = new StackPanel(); panel.VerticalAlignment = VerticalAlignment.Center; panel.HorizontalAlignment = HorizontalAlignment.Center; Aurigma.PhotoKiosk.OutlinedText cropOutliledText = new OutlinedText(cropStruct.Name, (Style)FindResource("CropParamsTextStyle")); cropOutliledText.HorizontalAlignment = HorizontalAlignment.Center; cropOutliledText.Margin = new Thickness(8, 0, 8, 0); panel.Children.Add(cropOutliledText); TextBlock cropTextBlock = new TextBlock(); cropTextBlock.Style = (Style)FindResource("ImageEditorButtonTextStyle"); cropTextBlock.HorizontalAlignment = HorizontalAlignment.Center; cropTextBlock.Text = cropTitle; panel.Children.Add(cropTextBlock); this.Content = panel; }
public OrderItem(PhotoItem item) { if (item == null) { throw new ArgumentNullException("item"); } _photoItem = item; _photoCounts = new Dictionary <PaperFormat, int>(ExecutionEngine.Instance.PaperFormats.Count); _photoCrops = new Dictionary <PaperFormat, Rect>(ExecutionEngine.Instance.PaperFormats.Count); foreach (PaperFormat format in ExecutionEngine.Instance.PaperFormats) { _photoCounts.Add(format, 0); _photoCrops.Add(format, new Rect()); } _imprintsCountText = new OutlinedText(); _imprintsCountText.Style = (Style)_imprintsCountText.FindResource("ImprintsCountTextStyle"); _imageCommandButton = new Button(); _imageCommandButton.Style = (Style)_imageCommandButton.FindResource("ImageCommandButtonStyle"); var grid = new Grid(); grid.Width = 60; grid.Height = 60; grid.RowDefinitions.Add(new RowDefinition()); grid.RowDefinitions[0].Height = new GridLength(40); grid.RowDefinitions.Add(new RowDefinition()); grid.RowDefinitions[1].Height = new GridLength(20); _imageCommandImage = new Image(); _imageCommandImage.Stretch = Stretch.None; Grid.SetRow(_imageCommandImage, 0); _imageCommandText = new TextBlock(); _imageCommandText.Margin = new Thickness(3, -5, 3, 0); _imageCommandText.Style = (Style)_imageCommandText.FindResource("ImageCommandTextStyle"); _imageCommandText.VerticalAlignment = VerticalAlignment.Center; _imageCommandText.HorizontalAlignment = HorizontalAlignment.Center; _imageCommandText.TextAlignment = TextAlignment.Center; _imageCommandText.LineHeight = 10; _imageCommandText.LineStackingStrategy = LineStackingStrategy.BlockLineHeight; Grid.SetRow(_imageCommandText, 1); grid.Children.Add(_imageCommandImage); grid.Children.Add(_imageCommandText); _imageCommandButton.Content = grid; }