Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UpdateProgress.cs
- MultitargetUtil.cs
- TcpTransportSecurityElement.cs
- CustomAssemblyResolver.cs
- ConnectionInterfaceCollection.cs
- ResourceExpressionBuilder.cs
- MarkupExtensionParser.cs
- InstanceStoreQueryResult.cs
- TabItemWrapperAutomationPeer.cs
- Cursor.cs
- WebPartEditVerb.cs
- StatusBarDrawItemEvent.cs
- BaseTemplateBuildProvider.cs
- StyleCollectionEditor.cs
- CollectionChangeEventArgs.cs
- ButtonFieldBase.cs
- X509Certificate.cs
- XmlSchemaAny.cs
- HtmlInputFile.cs
- FrameworkContentElement.cs
- XomlCompilerError.cs
- WebPartMinimizeVerb.cs
- JpegBitmapEncoder.cs
- EntityDataSourceState.cs
- EdmPropertyAttribute.cs
- SerializationInfoEnumerator.cs
- ProfileParameter.cs
- ImageListStreamer.cs
- ColorTransformHelper.cs
- Thread.cs
- ProcessModelInfo.cs
- _HelperAsyncResults.cs
- WpfSharedXamlSchemaContext.cs
- AsyncPostBackTrigger.cs
- AsyncContentLoadedEventArgs.cs
- UICuesEvent.cs
- ImageUrlEditor.cs
- SortedDictionary.cs
- ResourceAssociationSetEnd.cs
- SoapIncludeAttribute.cs
- PageCanvasSize.cs
- ToolStripPanelCell.cs
- HandlerBase.cs
- BypassElement.cs
- SizeAnimationClockResource.cs
- ScrollPatternIdentifiers.cs
- OleDbErrorCollection.cs
- IItemContainerGenerator.cs
- XPathChildIterator.cs
- FormsAuthenticationUser.cs
- CodeChecksumPragma.cs
- TypeSchema.cs
- OverflowException.cs
- ObjectPersistData.cs
- CellParaClient.cs
- SqlInternalConnection.cs
- CustomError.cs
- XmlSortKeyAccumulator.cs
- propertytag.cs
- BadImageFormatException.cs
- ZipPackage.cs
- MenuAutomationPeer.cs
- PrimitiveXmlSerializers.cs
- DesignerToolboxInfo.cs
- QilGeneratorEnv.cs
- SafeMILHandle.cs
- Form.cs
- DataGridViewCellConverter.cs
- ListenDesigner.cs
- PocoPropertyAccessorStrategy.cs
- ComboBox.cs
- ConstructorNeedsTagAttribute.cs
- SpeakCompletedEventArgs.cs
- InkCanvas.cs
- ExecutionEngineException.cs
- Stack.cs
- ServiceHostFactory.cs
- ImmutableObjectAttribute.cs
- SafeNativeMethodsCLR.cs
- ResourceDefaultValueAttribute.cs
- ObjectDataSourceMethodEventArgs.cs
- XhtmlConformanceSection.cs
- CodeAttributeDeclaration.cs
- ParserStreamGeometryContext.cs
- UInt64.cs
- ObjectDesignerDataSourceView.cs
- SafeEventLogWriteHandle.cs
- JsonReaderDelegator.cs
- PocoEntityKeyStrategy.cs
- DesignerValidatorAdapter.cs
- SizeKeyFrameCollection.cs
- RequestBringIntoViewEventArgs.cs
- VoiceObjectToken.cs
- HuffCodec.cs
- SqlTriggerContext.cs
- ToolStripMenuItem.cs
- Label.cs
- StateMachineSubscriptionManager.cs
- TemplateInstanceAttribute.cs
- ErrorTableItemStyle.cs