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 / Controls / Primitives / StatusBar.cs / 1 / StatusBar.cs
//----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.Windows.Automation.Peers;
using System.Windows.Media;
using System.Windows.Threading;
using MS.Internal.KnownBoxes;
namespace System.Windows.Controls.Primitives
{
///
/// StatusBar is a visual indicator of the operational status of an application and/or
/// its components running in a window. StatusBar control consists of a series of zones
/// on a band that can display text, graphics, or other rich content. The control can
/// group items within these zones to emphasize relational similarities or functional
/// connections. The StatusBar can accommodate multiple sets of UI or functionality that
/// can be chosen even within the same application.
///
[StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(StatusBarItem))]
public class StatusBar : ItemsControl
{
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
#region Constructors
static StatusBar()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(typeof(StatusBar)));
_dType = DependencyObjectType.FromSystemTypeInternal(typeof(StatusBar));
IsTabStopProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(BooleanBoxes.FalseBox));
ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(DockPanel)));
template.Seal();
ItemsPanelProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(template));
}
#endregion
//--------------------------------------------------------------------
//
// Protected Methods
//
//-------------------------------------------------------------------
#region Protected Methods
///
/// Return true if the item is (or is eligible to be) its own ItemUI
///
protected override bool IsItemItsOwnContainerOverride(object item)
{
return (item is StatusBarItem) || (item is Separator);
}
///
/// Create or identify the element used to display the given item
///
protected override DependencyObject GetContainerForItemOverride()
{
return new StatusBarItem();
}
///
/// Prepare the element to display the item. This may involve
/// applying styles, setting bindings, etc.
///
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
base.PrepareContainerForItemOverride(element, item);
Separator separator = element as Separator;
if (separator != null)
{
bool hasModifiers;
BaseValueSourceInternal vs = separator.GetValueSource(StyleProperty, null, out hasModifiers);
if (vs <= BaseValueSourceInternal.ImplicitReference)
separator.SetResourceReference(StyleProperty, SeparatorStyleKey);
separator.DefaultStyleKey = SeparatorStyleKey;
}
}
///
/// Determine whether the ItemContainerStyle/StyleSelector should apply to the container
///
/// false if item is a Separator, otherwise return true
protected override bool ShouldApplyItemContainerStyle(DependencyObject container, object item)
{
if (item is Separator)
{
return false;
}
else
{
return base.ShouldApplyItemContainerStyle(container, item);
}
}
#endregion
#region Accessibility
///
/// Creates AutomationPeer ( )
///
protected override AutomationPeer OnCreateAutomationPeer()
{
return new StatusBarAutomationPeer(this);
}
#endregion
#region DTypeThemeStyleKey
// Returns the DependencyObjectType for the registered ThemeStyleKey's default
// value. Controls will override this method to return approriate types.
internal override DependencyObjectType DTypeThemeStyleKey
{
get { return _dType; }
}
private static DependencyObjectType _dType;
#endregion DTypeThemeStyleKey
#region ItemsStyleKey
///
/// Resource Key for the SeparatorStyle
///
public static ResourceKey SeparatorStyleKey
{
get
{
if (_cacheSeparatorStyle == null)
{
_cacheSeparatorStyle = new SystemThemeKey(SystemResourceKeyID.StatusBarSeparatorStyle);
}
return _cacheSeparatorStyle;
}
}
private static SystemThemeKey _cacheSeparatorStyle;
#endregion
}
}
// 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.
//
//---------------------------------------------------------------------------
using System;
using System.Windows.Automation.Peers;
using System.Windows.Media;
using System.Windows.Threading;
using MS.Internal.KnownBoxes;
namespace System.Windows.Controls.Primitives
{
///
/// StatusBar is a visual indicator of the operational status of an application and/or
/// its components running in a window. StatusBar control consists of a series of zones
/// on a band that can display text, graphics, or other rich content. The control can
/// group items within these zones to emphasize relational similarities or functional
/// connections. The StatusBar can accommodate multiple sets of UI or functionality that
/// can be chosen even within the same application.
///
[StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(StatusBarItem))]
public class StatusBar : ItemsControl
{
//-------------------------------------------------------------------
//
// Constructors
//
//-------------------------------------------------------------------
#region Constructors
static StatusBar()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(typeof(StatusBar)));
_dType = DependencyObjectType.FromSystemTypeInternal(typeof(StatusBar));
IsTabStopProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(BooleanBoxes.FalseBox));
ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(DockPanel)));
template.Seal();
ItemsPanelProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(template));
}
#endregion
//--------------------------------------------------------------------
//
// Protected Methods
//
//-------------------------------------------------------------------
#region Protected Methods
///
/// Return true if the item is (or is eligible to be) its own ItemUI
///
protected override bool IsItemItsOwnContainerOverride(object item)
{
return (item is StatusBarItem) || (item is Separator);
}
///
/// Create or identify the element used to display the given item
///
protected override DependencyObject GetContainerForItemOverride()
{
return new StatusBarItem();
}
///
/// Prepare the element to display the item. This may involve
/// applying styles, setting bindings, etc.
///
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
base.PrepareContainerForItemOverride(element, item);
Separator separator = element as Separator;
if (separator != null)
{
bool hasModifiers;
BaseValueSourceInternal vs = separator.GetValueSource(StyleProperty, null, out hasModifiers);
if (vs <= BaseValueSourceInternal.ImplicitReference)
separator.SetResourceReference(StyleProperty, SeparatorStyleKey);
separator.DefaultStyleKey = SeparatorStyleKey;
}
}
///
/// Determine whether the ItemContainerStyle/StyleSelector should apply to the container
///
/// false if item is a Separator, otherwise return true
protected override bool ShouldApplyItemContainerStyle(DependencyObject container, object item)
{
if (item is Separator)
{
return false;
}
else
{
return base.ShouldApplyItemContainerStyle(container, item);
}
}
#endregion
#region Accessibility
///
/// Creates AutomationPeer ( )
///
protected override AutomationPeer OnCreateAutomationPeer()
{
return new StatusBarAutomationPeer(this);
}
#endregion
#region DTypeThemeStyleKey
// Returns the DependencyObjectType for the registered ThemeStyleKey's default
// value. Controls will override this method to return approriate types.
internal override DependencyObjectType DTypeThemeStyleKey
{
get { return _dType; }
}
private static DependencyObjectType _dType;
#endregion DTypeThemeStyleKey
#region ItemsStyleKey
///
/// Resource Key for the SeparatorStyle
///
public static ResourceKey SeparatorStyleKey
{
get
{
if (_cacheSeparatorStyle == null)
{
_cacheSeparatorStyle = new SystemThemeKey(SystemResourceKeyID.StatusBarSeparatorStyle);
}
return _cacheSeparatorStyle;
}
}
private static SystemThemeKey _cacheSeparatorStyle;
#endregion
}
}
// 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
- FileUtil.cs
- PeerContact.cs
- EdmToObjectNamespaceMap.cs
- MSG.cs
- SplitterCancelEvent.cs
- CodeDirectoryCompiler.cs
- CategoryGridEntry.cs
- AutomationPatternInfo.cs
- CommonRemoteMemoryBlock.cs
- SqlNotificationRequest.cs
- SuppressMergeCheckAttribute.cs
- HighlightComponent.cs
- PathFigureCollection.cs
- RoleGroupCollection.cs
- RequestCachingSection.cs
- MatrixTransform3D.cs
- StylusEventArgs.cs
- GraphicsContext.cs
- DispatcherHooks.cs
- ISFTagAndGuidCache.cs
- DateBoldEvent.cs
- XmlNodeReader.cs
- GiveFeedbackEvent.cs
- MobileControl.cs
- EditorBrowsableAttribute.cs
- ReferencedType.cs
- SQLSingleStorage.cs
- SqlDataSourceConnectionPanel.cs
- RayHitTestParameters.cs
- WebSysDisplayNameAttribute.cs
- SerializationAttributes.cs
- ProgressBarBrushConverter.cs
- XslAst.cs
- ControlBuilder.cs
- HttpSessionStateBase.cs
- WebHttpSecurity.cs
- PrinterUnitConvert.cs
- _SpnDictionary.cs
- QuadTree.cs
- DateTimeOffsetConverter.cs
- DataObjectSettingDataEventArgs.cs
- AppAction.cs
- _BaseOverlappedAsyncResult.cs
- AlphabeticalEnumConverter.cs
- FileInfo.cs
- PhotoPrintingIntent.cs
- SupportingTokenParameters.cs
- WriteableBitmap.cs
- DataRecordInfo.cs
- DBSchemaRow.cs
- PermissionToken.cs
- CompensatableSequenceActivity.cs
- ManualResetEvent.cs
- ConfigXmlElement.cs
- TextDecorationCollection.cs
- DynamicObjectAccessor.cs
- SrgsNameValueTag.cs
- RowUpdatingEventArgs.cs
- QueryCacheEntry.cs
- Socket.cs
- RectAnimationClockResource.cs
- MarkupExtensionReturnTypeAttribute.cs
- TableProvider.cs
- SymmetricKey.cs
- XamlVector3DCollectionSerializer.cs
- FontSizeConverter.cs
- ComponentSerializationService.cs
- NativeMethods.cs
- InvalidChannelBindingException.cs
- TreeIterator.cs
- Ipv6Element.cs
- UserInitiatedNavigationPermission.cs
- UnknownBitmapEncoder.cs
- TypeDependencyAttribute.cs
- TitleStyle.cs
- WithStatement.cs
- xmlfixedPageInfo.cs
- XmlExpressionDumper.cs
- ValidatorCompatibilityHelper.cs
- ContextStack.cs
- SmtpAuthenticationManager.cs
- StateMachineDesignerPaint.cs
- ReadOnlyDataSourceView.cs
- WindowsGraphics2.cs
- ListItemParagraph.cs
- Int32Collection.cs
- ExpressionPrefixAttribute.cs
- TypographyProperties.cs
- CompositeCollection.cs
- IERequestCache.cs
- SpeakInfo.cs
- ZoneButton.cs
- TTSVoice.cs
- TextElementEnumerator.cs
- Cursor.cs
- WpfGeneratedKnownTypes.cs
- OLEDB_Enum.cs
- SignedPkcs7.cs
- QueryOperationResponseOfT.cs
- AttributeUsageAttribute.cs