Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Documents / TableColumn.cs / 1 / TableColumn.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Table column object implementation.
//
// History:
// 06/19/2003 : olego - Created
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
using MS.Internal.PtsHost.UnsafeNativeMethods; // PTS restrictions
namespace System.Windows.Documents
{
///
/// Table column.
///
public class TableColumn : FrameworkContentElement
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
///
/// Creates an instance of a Column
///
public TableColumn()
{
_parentIndex = -1;
}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
#endregion Public Methods
//------------------------------------------------------
//
// Public Properties
//
//------------------------------------------------------
#region Public Properties
///
/// Width property.
///
public GridLength Width
{
get { return (GridLength) GetValue(WidthProperty); }
set { SetValue(WidthProperty, value); }
}
///
/// Background property.
///
public Brush Background
{
get { return (Brush) GetValue(BackgroundProperty); }
set { SetValue(BackgroundProperty, value); }
}
#endregion Public Properties
//-----------------------------------------------------
//
// Protected Methods
//
//------------------------------------------------------
#region Protected Methods
#endregion Protected Methods
//-----------------------------------------------------
//
// Internal Methods
//
//-----------------------------------------------------
#region Internal Methods
///
/// Callback used to notify the Cell about entering model tree.
///
internal void OnEnterParentTree()
{
Table.InvalidateColumns();
}
///
/// Callback used to notify the Cell about exitting model tree.
///
internal void OnExitParentTree()
{
Table.InvalidateColumns();
}
#endregion Internal Methods
//-----------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
///
/// Table owner accessor
///
internal Table Table { get { return Parent as Table; } }
///
/// Column's index in the parents collection.
///
internal int Index
{
get
{
return (_parentIndex);
}
set
{
Debug.Assert (value >= -1 && _parentIndex != value);
_parentIndex = value;
}
}
///
/// DefaultWidth
///
internal static GridLength DefaultWidth { get { return (new GridLength(0, GridUnitType.Auto)); } }
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Methods
//
//------------------------------------------------------
#region Private Methods
///
///
///
private static bool IsValidWidth(object value)
{
GridLength gridLength = (GridLength) value;
if ((gridLength.GridUnitType == GridUnitType.Pixel || gridLength.GridUnitType == GridUnitType.Star) &&
(gridLength.Value < 0.0))
{
return false;
}
double maxPixel = Math.Min(1000000, PTS.MaxPageSize);
if (gridLength.GridUnitType == GridUnitType.Pixel && (gridLength.Value > maxPixel))
{
return false;
}
return true;
}
#endregion Private Methods
//------------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private int _parentIndex; // column's index in parent's children collection
#endregion Private Fields
//------------------------------------------------------
//
// Properties
//
//-----------------------------------------------------
#region Properties
///
/// Width property.
///
public static readonly DependencyProperty WidthProperty =
DependencyProperty.Register(
"Width",
typeof(GridLength),
typeof(TableColumn),
new FrameworkPropertyMetadata(
new GridLength(0, GridUnitType.Auto),
FrameworkPropertyMetadataOptions.AffectsMeasure,
new PropertyChangedCallback(OnWidthChanged)),
new ValidateValueCallback(IsValidWidth));
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty BackgroundProperty =
Panel.BackgroundProperty.AddOwner(
typeof(TableColumn),
new FrameworkPropertyMetadata(
null,
FrameworkPropertyMetadataOptions.AffectsRender,
new PropertyChangedCallback(OnBackgroundChanged)));
#endregion Properties
//-----------------------------------------------------
//
// Static Initialization
//
//-----------------------------------------------------
#region Static Initialization
///
/// Called when the value of the WidthProperty changes
///
private static void OnWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Table table = ((TableColumn) d).Table;
if(table != null)
{
table.InvalidateColumns();
}
}
///
/// Called when the value of the BackgroundProperty changes
///
private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Table table = ((TableColumn) d).Table;
if(table != null)
{
table.InvalidateColumns();
}
}
#endregion Static Initialization
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Table column object implementation.
//
// History:
// 06/19/2003 : olego - Created
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
using MS.Internal.PtsHost.UnsafeNativeMethods; // PTS restrictions
namespace System.Windows.Documents
{
///
/// Table column.
///
public class TableColumn : FrameworkContentElement
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
///
/// Creates an instance of a Column
///
public TableColumn()
{
_parentIndex = -1;
}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
#endregion Public Methods
//------------------------------------------------------
//
// Public Properties
//
//------------------------------------------------------
#region Public Properties
///
/// Width property.
///
public GridLength Width
{
get { return (GridLength) GetValue(WidthProperty); }
set { SetValue(WidthProperty, value); }
}
///
/// Background property.
///
public Brush Background
{
get { return (Brush) GetValue(BackgroundProperty); }
set { SetValue(BackgroundProperty, value); }
}
#endregion Public Properties
//-----------------------------------------------------
//
// Protected Methods
//
//------------------------------------------------------
#region Protected Methods
#endregion Protected Methods
//-----------------------------------------------------
//
// Internal Methods
//
//-----------------------------------------------------
#region Internal Methods
///
/// Callback used to notify the Cell about entering model tree.
///
internal void OnEnterParentTree()
{
Table.InvalidateColumns();
}
///
/// Callback used to notify the Cell about exitting model tree.
///
internal void OnExitParentTree()
{
Table.InvalidateColumns();
}
#endregion Internal Methods
//-----------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
///
/// Table owner accessor
///
internal Table Table { get { return Parent as Table; } }
///
/// Column's index in the parents collection.
///
internal int Index
{
get
{
return (_parentIndex);
}
set
{
Debug.Assert (value >= -1 && _parentIndex != value);
_parentIndex = value;
}
}
///
/// DefaultWidth
///
internal static GridLength DefaultWidth { get { return (new GridLength(0, GridUnitType.Auto)); } }
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Methods
//
//------------------------------------------------------
#region Private Methods
///
///
///
private static bool IsValidWidth(object value)
{
GridLength gridLength = (GridLength) value;
if ((gridLength.GridUnitType == GridUnitType.Pixel || gridLength.GridUnitType == GridUnitType.Star) &&
(gridLength.Value < 0.0))
{
return false;
}
double maxPixel = Math.Min(1000000, PTS.MaxPageSize);
if (gridLength.GridUnitType == GridUnitType.Pixel && (gridLength.Value > maxPixel))
{
return false;
}
return true;
}
#endregion Private Methods
//------------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private int _parentIndex; // column's index in parent's children collection
#endregion Private Fields
//------------------------------------------------------
//
// Properties
//
//-----------------------------------------------------
#region Properties
///
/// Width property.
///
public static readonly DependencyProperty WidthProperty =
DependencyProperty.Register(
"Width",
typeof(GridLength),
typeof(TableColumn),
new FrameworkPropertyMetadata(
new GridLength(0, GridUnitType.Auto),
FrameworkPropertyMetadataOptions.AffectsMeasure,
new PropertyChangedCallback(OnWidthChanged)),
new ValidateValueCallback(IsValidWidth));
///
/// DependencyProperty for property.
///
public static readonly DependencyProperty BackgroundProperty =
Panel.BackgroundProperty.AddOwner(
typeof(TableColumn),
new FrameworkPropertyMetadata(
null,
FrameworkPropertyMetadataOptions.AffectsRender,
new PropertyChangedCallback(OnBackgroundChanged)));
#endregion Properties
//-----------------------------------------------------
//
// Static Initialization
//
//-----------------------------------------------------
#region Static Initialization
///
/// Called when the value of the WidthProperty changes
///
private static void OnWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Table table = ((TableColumn) d).Table;
if(table != null)
{
table.InvalidateColumns();
}
}
///
/// Called when the value of the BackgroundProperty changes
///
private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Table table = ((TableColumn) d).Table;
if(table != null)
{
table.InvalidateColumns();
}
}
#endregion Static Initialization
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EnumDataContract.cs
- DoubleUtil.cs
- GetWinFXPath.cs
- RowToFieldTransformer.cs
- AuditLevel.cs
- __Filters.cs
- MediaPlayer.cs
- WindowsListViewItemCheckBox.cs
- DBSqlParserTableCollection.cs
- SystemWebSectionGroup.cs
- SpnEndpointIdentityExtension.cs
- NavigationWindow.cs
- DBCSCodePageEncoding.cs
- DbProviderSpecificTypePropertyAttribute.cs
- MimeTypeMapper.cs
- SingletonChannelAcceptor.cs
- MouseGestureValueSerializer.cs
- CompilationLock.cs
- WsdlBuildProvider.cs
- WebExceptionStatus.cs
- ToolStripSettings.cs
- DomainLiteralReader.cs
- ObjectDataProvider.cs
- TypeNameConverter.cs
- DeviceContext.cs
- GraphicsContext.cs
- GrammarBuilder.cs
- ZipIOExtraField.cs
- SingleObjectCollection.cs
- QualificationDataItem.cs
- ToolStripMenuItem.cs
- PanningMessageFilter.cs
- WebBrowserContainer.cs
- FontNamesConverter.cs
- CacheSection.cs
- HeaderCollection.cs
- SecUtil.cs
- MetadataPropertyvalue.cs
- BinaryMessageFormatter.cs
- IntPtr.cs
- DataChangedEventManager.cs
- DispatcherOperation.cs
- AuthenticationManager.cs
- HttpProfileBase.cs
- TcpDuplicateContext.cs
- TraceSwitch.cs
- ListViewCommandEventArgs.cs
- IconConverter.cs
- SmtpAuthenticationManager.cs
- EditorBrowsableAttribute.cs
- basecomparevalidator.cs
- ModuleConfigurationInfo.cs
- DeadCharTextComposition.cs
- TemplateComponentConnector.cs
- LocalizabilityAttribute.cs
- SocketAddress.cs
- ExtendedPropertyDescriptor.cs
- CodeAttributeArgumentCollection.cs
- DodSequenceMerge.cs
- ValidationEventArgs.cs
- DbTransaction.cs
- UpdatableWrapper.cs
- DictionaryManager.cs
- RequiredFieldValidator.cs
- ValidationSummary.cs
- InternalSafeNativeMethods.cs
- MemoryResponseElement.cs
- XhtmlTextWriter.cs
- LinkedList.cs
- ProjectionCamera.cs
- CalendarButton.cs
- PropertyRecord.cs
- XmlSerializer.cs
- InkCanvasFeedbackAdorner.cs
- ContainerControl.cs
- ScrollPattern.cs
- DataListItemCollection.cs
- BitmapEffectRenderDataResource.cs
- GreaterThanOrEqual.cs
- UnsafeNativeMethodsPenimc.cs
- ThemeDictionaryExtension.cs
- ProjectedWrapper.cs
- TableLayoutPanel.cs
- ObjectItemCollection.cs
- MetadataArtifactLoaderComposite.cs
- FontStyles.cs
- PolicyManager.cs
- DbDataReader.cs
- HtmlTableRowCollection.cs
- Rectangle.cs
- PrefixQName.cs
- ViewCellRelation.cs
- DiffuseMaterial.cs
- FunctionQuery.cs
- DefinitionUpdate.cs
- WorkflowServiceAttributes.cs
- KnownBoxes.cs
- ProtectedConfigurationSection.cs
- XmlRawWriterWrapper.cs
- SerializationObjectManager.cs