Пример #1
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 {Interval = TimeSpan.FromMilliseconds(_timeSpan)};
            _refresher.Tick += OnAnimStateInvalidated;

            UpdateFromTarget();
        }
Пример #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 {
                Interval = TimeSpan.FromMilliseconds(_timeSpan)
            };
            _refresher.Tick += OnAnimStateInvalidated;

            UpdateFromTarget();
        }
Пример #3
0
        private void OnLoad(object sender, RoutedEventArgs e)
        {
            var app = Application.Current;

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

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

            for (var i = 0; i < _numItems; i++)
            {
                var 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);

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

                var demoButton = new Button {
                    Content = "# " + i
                };
                demoButton.Click += OnAdvanceClick;
                host.Child        = demoButton;
                //host.Child = Buttons[i] as Button;

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

                host.BindToTarget(target);
            }
        }
Пример #4
0
        private void OnLoad(object sender, RoutedEventArgs e)
        {
            var app = Application.Current;

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

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

            for (var i = 0; i < _numItems; i++)
            {
                var 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);

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

                var demoButton = new Button {Content = "# " + i};
                demoButton.Click += OnAdvanceClick;
                host.Child = demoButton;
                //host.Child = Buttons[i] as Button;

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

                host.BindToTarget(target);
            }
        }
Пример #5
0
        /*
         * If the host gets unloaded, break the cyclical reference to make sure the GC does its job
         * */

        private void OnUnload(object sender, RoutedEventArgs e)
        {
            Target.Host = null;
            Target = null;
        }
Пример #6
0
        /*
         * Break the cyclical reference
         * */

        public void ReleaseFromTarget()
        {
            Target.Host = null;
            Target = null;
        }
Пример #7
0
        /*
         * If the host gets unloaded, break the cyclical reference to make sure the GC does its job
         * */

        private void OnUnload(object sender, RoutedEventArgs e)
        {
            Target.Host = null;
            Target      = null;
        }
Пример #8
0
        /*
         * Break the cyclical reference
         * */

        public void ReleaseFromTarget()
        {
            Target.Host = null;
            Target      = null;
        }