Inheritance: INotifyPropertyChanged
コード例 #1
0
        /// <summary>
        /// Private constructor, used internally to create the childnodes of the root nodes.
        /// </summary>
        /// <param name="root"></param>
        /// <param name="parent"></param>
        /// <param name="level"></param>
        /// <param name="childrenCount"></param>
        /// <param name="maxDepth"></param>
        /// <param name="index"></param>
        private NodeViewModel( IRootNode root, NodeViewModel parent, int level, int childrenCount, int maxDepth, int index )
        {
            ChildNodes = new ObservableCollection<NodeViewModel>();
            Parent = parent;
            Root = root;
            Root.LevelChanged += OnLevelChanged;

            _level = level;
            _index = index;

            InitializeCoordinates( index );

            if( _level < maxDepth )
            {
                for( int i = 0; i < childrenCount; i++ )
                {
                    ChildNodes.Add( new NodeViewModel( root, this, _level + 1, childrenCount, maxDepth, i ) );
                }
            }
        }
コード例 #2
0
        private void InitializeGrid()
        {
            foreach( System.Windows.Forms.Screen s in System.Windows.Forms.Screen.AllScreens.Reverse() )
            {
                var node = new NodeViewModel( this, s.Bounds.Top, s.Bounds.Left, SquareSize * SquareSize, ClickDepth, false );

                ChildNodes.Add( node );
                var screen = new Screen();
                screen.DataContext = node;
                screen.Show();

                //A Window's Left & Top properties can't be bound.
                //Every time the framework sets it (when shown, moved, resized..) the binding is flushed.
                screen.Left = s.Bounds.Left;
                screen.Top = s.Bounds.Top;
                screen.WindowState = WindowState.Maximized;
                _screens.Add( screen );
            }
        }