Esempio n. 1
0
 /// <summary>
 /// Move all buttons into the wrap panel
 /// </summary>
 public void DoMoveToWrap()
 {
     ClearPanels();
     for (int i = 0; i < numItems; i++)
     {
         LayoutToLayoutTarget target = Targets[i] as LayoutToLayoutTarget;
         //(Hosts[i] as LayoutToLayoutHost).BeginAnimating(false);
         LTLWrapPanel.Children.Add(target);
     }
 }
Esempio n. 2
0
        /*
         * Link up the Host to the Target and initialize but do not start the timer
         * */
        public void BindToTarget(LayoutToLayoutTarget t)
        {
            Target          = t;
            t.Host          = this;
            translation     = new TranslateTransform(0, 0);
            RenderTransform = translation;

            Refresher          = new DispatcherTimer();
            Refresher.Interval = TimeSpan.FromMilliseconds(timeSpan);
            Refresher.Tick    += OnAnimStateInvalidated;

            UpdateFromTarget();
        }
Esempio n. 3
0
        /// <summary>
        /// Move all buttons into the 3x3 grid
        /// </summary>
        public void DoMoveToGrid3()
        {
            ClearPanels();
            gridSize = 3;
            counter  = 0;

            for (int i = 0; i < numItems; i++)
            {
                LayoutToLayoutTarget target = Targets[i] as LayoutToLayoutTarget;
                //(Hosts[i] as LayoutToLayoutHost).BeginAnimating(false);
                Grid.SetRow(target, i / 3);
                Grid.SetColumn(target, i % 3);
                LTLGrid2.Children.Add(target);
            }
        }
Esempio n. 4
0
        void OnLoad(object sender, RoutedEventArgs e)
        {
            Application app = System.Windows.Application.Current;

            Panels.Add(LTLGrid);
            Panels.Add(LTLGrid2);
            Panels.Add(LTLStackPanel);
            Panels.Add(LTLWrapPanel);

            //Debug.WriteLine("Grid children: " + ButtonGrid.Children.Count);

            for (int i = 0; i < numItems; i++)
            {
                LayoutToLayoutTarget target = new LayoutToLayoutTarget();
                Targets.Add(target);
                target.Margin          = new Thickness(5);
                target.MinWidth        = 80; target.MinHeight = 50;
                target.BorderThickness = new Thickness(0);

                Grid.SetRow(target, i / 5);
                Grid.SetColumn(target, i % 5);
                LTLGrid.Children.Add(target);

                LayoutToLayoutHost host = new LayoutToLayoutHost();
                Hosts.Add(host);
                host.BorderThickness = new Thickness(0);

                Button demoButton = new Button();
                demoButton.Content = "# " + i;
                demoButton.Click  += OnAdvanceClick;
                host.Child         = demoButton;

                Canvas.SetLeft(host, 0); Canvas.SetTop(host, 0);
                LTLCanvas.Children.Add(host);

                host.BindToTarget(target);
            }
        }
Esempio n. 5
0
 /*
  * Break the cyclical reference
  * */
 public void ReleaseFromTarget()
 {
     Target.Host = null;
     Target      = null;
 }
Esempio n. 6
0
 /*
  * If the host gets unloaded, break the cyclical reference to make sure the GC does its job
  * */
 void OnUnload(object sender, RoutedEventArgs e)
 {
     Target.Host = null;
     Target      = null;
 }