Пример #1
0
        private void ChangeItem(ToggleButton bt)
        {
            int count = 0;

            for (int i = 0; i < _numItemsArr[_currentIndex]; i++)
            {
                LayoutToLayoutTarget target = (_targetsArr[_currentIndex])[i] as LayoutToLayoutTarget;
                LayoutToLayoutHost   host   = (_hostsArr[_currentIndex])[i] as LayoutToLayoutHost;
                host.BeginAnimating(false);
                ContainerViewUserControl hostcv = host.Child as ContainerViewUserControl;
                ToggleButton             hostBt = hostcv.Minimize;
                if (hostBt.Equals(bt))
                {
                    Grid.SetRow(target, 0);
                    Grid.SetColumn(target, 0);
                    Grid.SetRowSpan(target, _numItemsArr[_currentIndex] - 1);
                    Grid.SetColumnSpan(target, 1);
                    //hostBt.IsChecked = true;
                }
                else
                {
                    Grid.SetRow(target, count);
                    Grid.SetColumn(target, 1);
                    Grid.SetRowSpan(target, 1);
                    Grid.SetColumnSpan(target, 1);
                    hostBt.IsChecked = false;
                    count++;
                }
            }
        }
Пример #2
0
        private void MedToLar(ToggleButton bt)
        {
            _flagArr[_currentIndex] = true;
            _gridChildrenArr[_currentIndex, 0].Children.Clear();
            int count = 0;

            for (int i = 0; i < _numItemsArr[_currentIndex]; i++)
            {
                LayoutToLayoutTarget target = (_targetsArr[_currentIndex])[i] as LayoutToLayoutTarget;
                LayoutToLayoutHost   host   = (_hostsArr[_currentIndex])[i] as LayoutToLayoutHost;
                host.BeginAnimating(false);
                ContainerViewUserControl hostcv = host.Child as ContainerViewUserControl;
                ToggleButton             hostBt = hostcv.Minimize;
                if (hostBt.Equals(bt))
                {
                    Grid.SetRow(target, 0);
                    Grid.SetColumn(target, 0);
                    Grid.SetRowSpan(target, _numItemsArr[_currentIndex] - 1);
                    Grid.SetColumnSpan(target, 1);
                }
                else
                {
                    Grid.SetRow(target, count);
                    Grid.SetColumn(target, 1);
                    count++;
                }
                _gridChildrenArr[_currentIndex, 1].Children.Add(target);
            }
        }
Пример #3
0
        private void LoadControl(int numItems, UserControl[] userCtrls)
        {
            for (int i = 0; i < _numItemsArr[numItems]; i++)
            {
                LayoutToLayoutTarget target = new LayoutToLayoutTarget();
                _targetsArr[numItems].Add(target);
                target.Margin          = new Thickness(2);
                target.BorderThickness = new Thickness(0);
                Grid.SetRow(target, i / _gridSizeArr[numItems]);
                Grid.SetColumn(target, i % _gridSizeArr[numItems]);
                _gridChildrenArr[numItems, 0].Children.Add(target);

                LayoutToLayoutHost host = new LayoutToLayoutHost();
                _hostsArr[numItems].Add(host);
                host.BorderThickness = new Thickness(0);
                UserControl userCtrl = new ContainerViewUserControl();
                ((ContainerViewUserControl)userCtrl).grdContent.Children.Add(userCtrls[i]);
                ((ContainerViewUserControl)userCtrl).Minimize.Click += new RoutedEventHandler(Minimize_Click);
                host.Child = userCtrl;
                if (i == 0)
                {
                    ((ContainerViewUserControl)userCtrl).txtName.Text = "Đội Xe";
                }
                else if (i == 1)
                {
                    ((ContainerViewUserControl)userCtrl).txtName.Text = "Tài Xế";
                }
                else if (i == 2)
                {
                    ((ContainerViewUserControl)userCtrl).txtName.Text = "Xe";
                }
                else if (i == 3)
                {
                    ((ContainerViewUserControl)userCtrl).txtName.Text = "Thông tin";
                }
                Canvas.SetLeft(host, 0);
                Canvas.SetRight(host, 0);
                _canvasArr[numItems].Children.Add(host);

                host.BindToTarget(target);
            }
        }