public void SetContent(string label, bool useMnemonic, ImageDescription image, ContentPosition position) { var accessText = new SWC.AccessText(); accessText.Text = label; if (image.IsNull) { if (useMnemonic) { Button.Content = accessText; } else { Button.Content = accessText.Text.Replace("_", "__"); } } else { SWC.DockPanel grid = new SWC.DockPanel(); var imageCtrl = new ImageBox(Context); imageCtrl.ImageSource = image; SWC.DockPanel.SetDock(imageCtrl, DataConverter.ToWpfDock(position)); grid.Children.Add(imageCtrl); if (!string.IsNullOrEmpty(label)) { SWC.Label labelCtrl = new SWC.Label(); if (useMnemonic) { labelCtrl.Content = accessText; } else { labelCtrl.Content = label; } labelCtrl.SetBinding(SWC.Label.ForegroundProperty, new Binding("Foreground") { Source = Button }); grid.Children.Add(labelCtrl); } Button.Content = grid; } Button.InvalidateMeasure(); }
public void SetContent(string label, bool useMnemonic, ImageDescription image, ContentPosition position) { var accessText = new SWC.AccessText (); accessText.Text = label; if (image.IsNull) if (useMnemonic) Button.Content = accessText; else Button.Content = accessText.Text.Replace ("_", "__"); else { SWC.DockPanel grid = new SWC.DockPanel (); var imageCtrl = new ImageBox (Context); imageCtrl.ImageSource = image; SWC.DockPanel.SetDock (imageCtrl, DataConverter.ToWpfDock (position)); grid.Children.Add (imageCtrl); if (!string.IsNullOrEmpty (label)) { SWC.Label labelCtrl = new SWC.Label (); if (useMnemonic) labelCtrl.Content = accessText; else labelCtrl.Content = label; labelCtrl.SetBinding (SWC.Label.ForegroundProperty, new Binding ("Foreground") { Source = Button }); grid.Children.Add (labelCtrl); } Button.Content = grid; } Button.InvalidateMeasure (); }
protected override void Initialize () { base.Initialize (); Widget = new ImageBox (Context); }
public void SetContent(string label, ImageDescription image, ContentPosition position) { if (image.IsNull) Button.Content = label; else { SWC.DockPanel grid = new SWC.DockPanel (); var imageCtrl = new ImageBox (Context); imageCtrl.ImageSource = image; SWC.DockPanel.SetDock (imageCtrl, DataConverter.ToWpfDock (position)); grid.Children.Add (imageCtrl); if (!string.IsNullOrEmpty (label)) { SWC.Label labelCtrl = new SWC.Label (); labelCtrl.Content = label; grid.Children.Add (labelCtrl); } Button.Content = grid; } Button.InvalidateMeasure (); }
protected override void Initialize() { base.Initialize(); Widget = new ImageBox(Context); }