예제 #1
0
        public void LoadFromData(string selectedID)
        {
            selectedId = selectedID;
            foreach (PhoneLayoutButton layout in phoneLayout.Buttons)
            {
                if (layout.IsEnabled || layout.Id == selectedID)
                {
                    PhoneUIElementButton button = new PhoneUIElementButton();
                    button.Text       = layout.Text;
                    button.ImageFile  = layout.ImageFile;
                    button.Tag        = layout.Id;
                    button.LayoutInfo = layout;
                    Canvas.SetLeft(button, layout.X);
                    Canvas.SetTop(button, layout.Y);
                    canvas1.Children.Add(button);
                    if (layout.Id == selectedID)
                    {
                        SelectedElement   = button;
                        button.IsSelected = true;
                    }

                    if (!layout.IsEnabled)
                    {
                        textErrorButtonDisabled.Visibility = Visibility.Visible;
                        button.Opacity = 0.5;
                    }
                }
            }
        }
예제 #2
0
 public override void OnSave()
 {
     for (int i = 0; i < canvas1.Children.Count; i++)
     {
         if (canvas1.Children[i] is PhoneUIElementButton)
         {
             PhoneUIElementButton button = canvas1.Children[i] as PhoneUIElementButton;
             button.LayoutInfo.ImageFile = button.ImageFile;
             button.LayoutInfo.Text      = button.Text;
             button.LayoutInfo.X         = Canvas.GetLeft(button) + (button.IsGridOnRight ? 0 : button.gridEdit.ActualWidth);
             button.LayoutInfo.Y         = Canvas.GetTop(button);
             button.LayoutInfo.Width     = button.border1.ActualWidth;
             button.LayoutInfo.Height    = button.border1.ActualHeight;
         }
     }
 }