Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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 ();
        }
Exemplo n.º 3
0
		protected override void Initialize ()
		{
			base.Initialize ();
			Widget = new ImageBox (Context);
		}
Exemplo n.º 4
0
        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 ();
        }
Exemplo n.º 5
0
 protected override void Initialize()
 {
     base.Initialize();
     Widget = new ImageBox(Context);
 }