Esempio n. 1
0
        private void SaveWidth()
        {
            if (this.Parent == null)
            {
                return;
            }
            Grid parent = this.Parent as Grid;

            if (parent == null)
            {
                FrameworkElement border = this.Parent as FrameworkElement;
                if (border != null)
                {
                    parent = border.Parent as Grid;
                }
            }
            if (parent != null)
            {
                int columnIndex = Grid.GetColumn(this);
                if (columnIndex < parent.ColumnDefinitions.Count)
                {
                    m_Width = new GridLengthHolder(parent.ColumnDefinitions[columnIndex].Width);
                    parent.ColumnDefinitions[columnIndex].Width = GridLength.Auto;
                }
            }
        }
 private void SaveWidth()
 {
     if (this.Parent == null) return;
     Grid parent = this.Parent as Grid;
     if (parent == null)
     {
         FrameworkElement border = this.Parent as FrameworkElement;
         if (border != null)
         {
             parent = border.Parent as Grid;
         }
     }
     if (parent != null)
     {
         int columnIndex = Grid.GetColumn(this);
         if (columnIndex < parent.ColumnDefinitions.Count)
         {
             m_Width = new GridLengthHolder(parent.ColumnDefinitions[columnIndex].Width);
             parent.ColumnDefinitions[columnIndex].Width = GridLength.Auto;
         }
     }
 }