VisualStates.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Controls / VisualStates.cs / 1305600 / VisualStates.cs

                            // -------------------------------------------------------------------- 
// Copyright (c) Microsoft Corporation. All Rights Reserved.
// -------------------------------------------------------------------

using System; 
using System.Windows;
using System.Security; 
using System.Runtime.InteropServices; 

using MS.Internal; 

namespace System.Windows.Controls
{
    ///  
    /// Names and helpers for visual states in the controls.
    /// THIS IS A SHARED FILE.  PresentationFramework.Design.dll must be rebuilt if changed. 
    ///  
    internal static class VisualStates
    { 
        #region CalendarDayButton

        /// 
        /// Identifies the Today state. 
        /// 
        internal const string StateToday = "Today"; 
 
        /// 
        /// Identifies the RegularDay state. 
        /// 
        internal const string StateRegularDay = "RegularDay";

        ///  
        /// Name of the Day state group.
        ///  
        internal const string GroupDay = "DayStates"; 

        ///  
        /// Identifies the BlackoutDay state.
        /// 
        internal const string StateBlackoutDay = "BlackoutDay";
 
        /// 
        /// Identifies the NormalDay state. 
        ///  
        internal const string StateNormalDay = "NormalDay";
 
        /// 
        /// Name of the BlackoutDay state group.
        /// 
        internal const string GroupBlackout = "BlackoutDayStates"; 

        #endregion Constants 
 
        #region GroupCalendarButtonFocus
        ///  
        /// Unfocused state for Calendar Buttons
        /// 
        public const string StateCalendarButtonUnfocused = "CalendarButtonUnfocused";
 
        /// 
        /// Focused state for Calendar Buttons 
        ///  
        public const string StateCalendarButtonFocused = "CalendarButtonFocused";
 
        /// 
        /// CalendarButtons Focus state group
        /// 
        public const string GroupCalendarButtonFocus = "CalendarButtonFocusStates"; 

        #endregion GroupCalendarButtonFocus 
 
        #region GroupCommon
        ///  
        /// Normal state
        /// 
        public const string StateNormal = "Normal";
 
        /// 
        /// MouseOver state 
        ///  
        public const string StateMouseOver = "MouseOver";
 
        /// 
        /// Pressed state
        /// 
        public const string StatePressed = "Pressed"; 

        ///  
        /// Disabled state 
        /// 
        public const string StateDisabled = "Disabled"; 

        /// 
        /// Readonly state
        ///  
        public const string StateReadOnly = "ReadOnly";
 
        ///  
        /// Transition into the Normal state in the ProgressBar template.
        ///  
        internal const string StateDeterminate = "Determinate";

        /// 
        /// Transition into ---- state in the ProgressBar template. 
        /// 
        // 
 

        ///  
        /// Common state group
        /// 
        public const string GroupCommon = "CommonStates";
        #endregion GroupCommon 

        #region GroupFocus 
        ///  
        /// Unfocused state
        ///  
        public const string StateUnfocused = "Unfocused";

        /// 
        /// Focused state 
        /// 
        public const string StateFocused = "Focused"; 
 
        /// 
        /// Focused and Dropdown is showing state 
        /// 
        public const string StateFocusedDropDown = "FocusedDropDown";

        ///  
        /// Focus state group
        ///  
        public const string GroupFocus = "FocusStates"; 
        #endregion GroupFocus
 
         #region GroupExpansion

        /// 
        /// Expanded state of the Expansion state group. 
        /// 
        public const string StateExpanded = "Expanded"; 
 
        /// 
        /// Collapsed state of the Expansion state group. 
        /// 
        public const string StateCollapsed = "Collapsed";

        ///  
        /// Expansion state group.
        ///  
        public const string GroupExpansion = "ExpansionStates"; 
        #endregion GroupExpansion
 
        #region GroupOpen

        public const string StateOpen = "Open";
        public const string StateClosed = "Closed"; 

        public const string GroupOpen = "OpenStates"; 
 
        #endregion
 
        #region GroupHasItems

        /// 
        /// HasItems state of the HasItems state group. 
        /// 
        public const string StateHasItems = "HasItems"; 
 
        /// 
        /// NoItems state of the HasItems state group. 
        /// 
        public const string StateNoItems = "NoItems";

        ///  
        /// HasItems state group.
        ///  
        public const string GroupHasItems = "HasItemsStates"; 
        #endregion GroupHasItems
 
        #region GroupExpandDirection

        /// 
        /// Down expand direction state of ExpandDirection state group. 
        /// 
        public const string StateExpandDown = "ExpandDown"; 
 
        /// 
        /// Up expand direction state of ExpandDirection state group. 
        /// 
        public const string StateExpandUp = "ExpandUp";

        ///  
        /// Left expand direction state of ExpandDirection state group.
        ///  
        public const string StateExpandLeft = "ExpandLeft"; 

        ///  
        /// Right expand direction state of ExpandDirection state group.
        /// 
        public const string StateExpandRight = "ExpandRight";
 
        /// 
        /// ExpandDirection state group. 
        ///  
        public const string GroupExpandDirection = "ExpandDirectionStates";
        #endregion 


        #region GroupSelection
        ///  
        /// Selected state
        ///  
        public const string StateSelected = "Selected"; 

        ///  
        /// Selected and unfocused state
        /// 
        public const string StateSelectedUnfocused = "SelectedUnfocused";
 
        /// 
        /// Selected and inactive state 
        ///  
        public const string StateSelectedInactive = "SelectedInactive";
 
        /// 
        /// Unselected state
        /// 
        public const string StateUnselected = "Unselected"; 

        ///  
        /// Selection state group 
        /// 
        public const string GroupSelection = "SelectionStates"; 
        #endregion GroupSelection

        #region GroupEdit
        ///  
        /// Editable state
        ///  
        public const string StateEditable = "Editable"; 

        ///  
        /// Uneditable state
        /// 
        public const string StateUneditable = "Uneditable";
 
        /// 
        /// Edit state group 
        ///  
        public const string GroupEdit = "EditStates";
        #endregion GroupEdit 

        #region GroupActive
        /// 
        /// Active state 
        /// 
        public const string StateActive = "Active"; 
 
        /// 
        /// Inactive state 
        /// 
        public const string StateInactive = "Inactive";

        ///  
        /// Active state group
        ///  
        public const string GroupActive = "ActiveStates"; 
        #endregion GroupActive
 
        #region GroupValidation
        /// 
        /// Valid state
        ///  
        public const string StateValid = "Valid";
 
        ///  
        /// InvalidFocused state
        ///  
        public const string StateInvalidFocused = "InvalidFocused";

        /// 
        /// InvalidUnfocused state 
        /// 
        public const string StateInvalidUnfocused = "InvalidUnfocused"; 
 
        /// 
        /// Validation state group 
        /// 
        public const string GroupValidation = "ValidationStates";
        #endregion GroupValidation
 
        #region GroupWatermark
        ///  
        /// Unwatermarked state 
        /// 
        public const string StateUnwatermarked = "Unwatermarked"; 

        /// 
        /// Watermarked state
        ///  
        public const string StateWatermarked = "Watermarked";
 
        ///  
        /// Watermark state group
        ///  
        public const string GroupWatermark = "WatermarkStates";
        #endregion GroupWatermark

        #region GroupChecked 

        public const string StateChecked = "Checked"; 
        public const string StateUnchecked = "Unchecked"; 
        public const string StateIndeterminate = "Indeterminate";
 
        public const string GroupCheck = "CheckStates";

        #endregion
 
        #region GroupCurrent
        ///  
        /// Regular state 
        /// 
        public const string StateRegular = "Regular"; 

        /// 
        /// Current state
        ///  
        public const string StateCurrent = "Current";
 
        ///  
        /// Current state group
        ///  
        public const string GroupCurrent = "CurrentStates";
        #endregion GroupCurrent

        #region GroupInteraction 
        /// 
        /// Display state 
        ///  
        public const string StateDisplay = "Display";
 
        /// 
        /// Editing state
        /// 
        public const string StateEditing = "Editing"; 

        ///  
        /// Interaction state group 
        /// 
        public const string GroupInteraction = "InteractionStates"; 
        #endregion GroupInteraction


        #region GroupSort 
        /// 
        /// Unsorted state 
        ///  
        public const string StateUnsorted = "Unsorted";
 
        /// 
        /// Sort Ascending state
        /// 
        public const string StateSortAscending = "SortAscending"; 

        ///  
        /// Sort Descending state 
        /// 
        public const string StateSortDescending = "SortDescending"; 

        /// 
        /// Sort state group
        ///  
        public const string GroupSort = "SortStates";
        #endregion GroupSort 
 
        #region DataGridRow
 
        public const string DATAGRIDROW_stateAlternate = "Normal_AlternatingRow";
        public const string DATAGRIDROW_stateMouseOver = "MouseOver";
        public const string DATAGRIDROW_stateMouseOverEditing = "MouseOver_Unfocused_Editing";
        public const string DATAGRIDROW_stateMouseOverEditingFocused = "MouseOver_Editing"; 
        public const string DATAGRIDROW_stateMouseOverSelected = "MouseOver_Unfocused_Selected";
        public const string DATAGRIDROW_stateMouseOverSelectedFocused = "MouseOver_Selected"; 
        public const string DATAGRIDROW_stateNormal = "Normal"; 
        public const string DATAGRIDROW_stateNormalEditing = "Unfocused_Editing";
        public const string DATAGRIDROW_stateNormalEditingFocused = "Normal_Editing"; 
        public const string DATAGRIDROW_stateSelected = "Unfocused_Selected";
        public const string DATAGRIDROW_stateSelectedFocused = "Normal_Selected";

        #endregion DataGridRow 

        #region DataGridRowHeader 
 
        public const string DATAGRIDROWHEADER_stateMouseOver = "MouseOver";
        public const string DATAGRIDROWHEADER_stateMouseOverCurrentRow = "MouseOver_CurrentRow"; 
        public const string DATAGRIDROWHEADER_stateMouseOverEditingRow = "MouseOver_Unfocused_EditingRow";
        public const string DATAGRIDROWHEADER_stateMouseOverEditingRowFocused = "MouseOver_EditingRow";
        public const string DATAGRIDROWHEADER_stateMouseOverSelected = "MouseOver_Unfocused_Selected";
        public const string DATAGRIDROWHEADER_stateMouseOverSelectedCurrentRow = "MouseOver_Unfocused_CurrentRow_Selected"; 
        public const string DATAGRIDROWHEADER_stateMouseOverSelectedCurrentRowFocused = "MouseOver_CurrentRow_Selected";
        public const string DATAGRIDROWHEADER_stateMouseOverSelectedFocused = "MouseOver_Selected"; 
        public const string DATAGRIDROWHEADER_stateNormal = "Normal"; 
        public const string DATAGRIDROWHEADER_stateNormalCurrentRow = "Normal_CurrentRow";
        public const string DATAGRIDROWHEADER_stateNormalEditingRow = "Unfocused_EditingRow"; 
        public const string DATAGRIDROWHEADER_stateNormalEditingRowFocused = "Normal_EditingRow";
        public const string DATAGRIDROWHEADER_stateSelected = "Unfocused_Selected";
        public const string DATAGRIDROWHEADER_stateSelectedCurrentRow = "Unfocused_CurrentRow_Selected";
        public const string DATAGRIDROWHEADER_stateSelectedCurrentRowFocused = "Normal_CurrentRow_Selected"; 
        public const string DATAGRIDROWHEADER_stateSelectedFocused = "Normal_Selected";
 
        #endregion DataGridRowHeader 

 
        /// 
        /// Use VisualStateManager to change the visual state of the control.
        /// 
        ///  
        /// Control whose visual state is being changed.
        ///  
        ///  
        /// true to use transitions when updating the visual state, false to
        /// snap directly to the new visual state. 
        /// 
        /// 
        /// Ordered list of state names and fallback states to transition into.
        /// Only the first state to be found will be used. 
        /// 
        public static void GoToState(Control control, bool useTransitions, params string[] stateNames) 
        { 
            if (stateNames == null)
            { 
                return;
            }

            foreach (string name in stateNames) 
            {
                if (VisualStateManager.GoToState(control, name, useTransitions)) 
                { 
                    break;
                } 
            }
        }
    }
} 

// 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;
using System.Security; 
using System.Runtime.InteropServices; 

using MS.Internal; 

namespace System.Windows.Controls
{
    ///  
    /// Names and helpers for visual states in the controls.
    /// THIS IS A SHARED FILE.  PresentationFramework.Design.dll must be rebuilt if changed. 
    ///  
    internal static class VisualStates
    { 
        #region CalendarDayButton

        /// 
        /// Identifies the Today state. 
        /// 
        internal const string StateToday = "Today"; 
 
        /// 
        /// Identifies the RegularDay state. 
        /// 
        internal const string StateRegularDay = "RegularDay";

        ///  
        /// Name of the Day state group.
        ///  
        internal const string GroupDay = "DayStates"; 

        ///  
        /// Identifies the BlackoutDay state.
        /// 
        internal const string StateBlackoutDay = "BlackoutDay";
 
        /// 
        /// Identifies the NormalDay state. 
        ///  
        internal const string StateNormalDay = "NormalDay";
 
        /// 
        /// Name of the BlackoutDay state group.
        /// 
        internal const string GroupBlackout = "BlackoutDayStates"; 

        #endregion Constants 
 
        #region GroupCalendarButtonFocus
        ///  
        /// Unfocused state for Calendar Buttons
        /// 
        public const string StateCalendarButtonUnfocused = "CalendarButtonUnfocused";
 
        /// 
        /// Focused state for Calendar Buttons 
        ///  
        public const string StateCalendarButtonFocused = "CalendarButtonFocused";
 
        /// 
        /// CalendarButtons Focus state group
        /// 
        public const string GroupCalendarButtonFocus = "CalendarButtonFocusStates"; 

        #endregion GroupCalendarButtonFocus 
 
        #region GroupCommon
        ///  
        /// Normal state
        /// 
        public const string StateNormal = "Normal";
 
        /// 
        /// MouseOver state 
        ///  
        public const string StateMouseOver = "MouseOver";
 
        /// 
        /// Pressed state
        /// 
        public const string StatePressed = "Pressed"; 

        ///  
        /// Disabled state 
        /// 
        public const string StateDisabled = "Disabled"; 

        /// 
        /// Readonly state
        ///  
        public const string StateReadOnly = "ReadOnly";
 
        ///  
        /// Transition into the Normal state in the ProgressBar template.
        ///  
        internal const string StateDeterminate = "Determinate";

        /// 
        /// Transition into ---- state in the ProgressBar template. 
        /// 
        // 
 

        ///  
        /// Common state group
        /// 
        public const string GroupCommon = "CommonStates";
        #endregion GroupCommon 

        #region GroupFocus 
        ///  
        /// Unfocused state
        ///  
        public const string StateUnfocused = "Unfocused";

        /// 
        /// Focused state 
        /// 
        public const string StateFocused = "Focused"; 
 
        /// 
        /// Focused and Dropdown is showing state 
        /// 
        public const string StateFocusedDropDown = "FocusedDropDown";

        ///  
        /// Focus state group
        ///  
        public const string GroupFocus = "FocusStates"; 
        #endregion GroupFocus
 
         #region GroupExpansion

        /// 
        /// Expanded state of the Expansion state group. 
        /// 
        public const string StateExpanded = "Expanded"; 
 
        /// 
        /// Collapsed state of the Expansion state group. 
        /// 
        public const string StateCollapsed = "Collapsed";

        ///  
        /// Expansion state group.
        ///  
        public const string GroupExpansion = "ExpansionStates"; 
        #endregion GroupExpansion
 
        #region GroupOpen

        public const string StateOpen = "Open";
        public const string StateClosed = "Closed"; 

        public const string GroupOpen = "OpenStates"; 
 
        #endregion
 
        #region GroupHasItems

        /// 
        /// HasItems state of the HasItems state group. 
        /// 
        public const string StateHasItems = "HasItems"; 
 
        /// 
        /// NoItems state of the HasItems state group. 
        /// 
        public const string StateNoItems = "NoItems";

        ///  
        /// HasItems state group.
        ///  
        public const string GroupHasItems = "HasItemsStates"; 
        #endregion GroupHasItems
 
        #region GroupExpandDirection

        /// 
        /// Down expand direction state of ExpandDirection state group. 
        /// 
        public const string StateExpandDown = "ExpandDown"; 
 
        /// 
        /// Up expand direction state of ExpandDirection state group. 
        /// 
        public const string StateExpandUp = "ExpandUp";

        ///  
        /// Left expand direction state of ExpandDirection state group.
        ///  
        public const string StateExpandLeft = "ExpandLeft"; 

        ///  
        /// Right expand direction state of ExpandDirection state group.
        /// 
        public const string StateExpandRight = "ExpandRight";
 
        /// 
        /// ExpandDirection state group. 
        ///  
        public const string GroupExpandDirection = "ExpandDirectionStates";
        #endregion 


        #region GroupSelection
        ///  
        /// Selected state
        ///  
        public const string StateSelected = "Selected"; 

        ///  
        /// Selected and unfocused state
        /// 
        public const string StateSelectedUnfocused = "SelectedUnfocused";
 
        /// 
        /// Selected and inactive state 
        ///  
        public const string StateSelectedInactive = "SelectedInactive";
 
        /// 
        /// Unselected state
        /// 
        public const string StateUnselected = "Unselected"; 

        ///  
        /// Selection state group 
        /// 
        public const string GroupSelection = "SelectionStates"; 
        #endregion GroupSelection

        #region GroupEdit
        ///  
        /// Editable state
        ///  
        public const string StateEditable = "Editable"; 

        ///  
        /// Uneditable state
        /// 
        public const string StateUneditable = "Uneditable";
 
        /// 
        /// Edit state group 
        ///  
        public const string GroupEdit = "EditStates";
        #endregion GroupEdit 

        #region GroupActive
        /// 
        /// Active state 
        /// 
        public const string StateActive = "Active"; 
 
        /// 
        /// Inactive state 
        /// 
        public const string StateInactive = "Inactive";

        ///  
        /// Active state group
        ///  
        public const string GroupActive = "ActiveStates"; 
        #endregion GroupActive
 
        #region GroupValidation
        /// 
        /// Valid state
        ///  
        public const string StateValid = "Valid";
 
        ///  
        /// InvalidFocused state
        ///  
        public const string StateInvalidFocused = "InvalidFocused";

        /// 
        /// InvalidUnfocused state 
        /// 
        public const string StateInvalidUnfocused = "InvalidUnfocused"; 
 
        /// 
        /// Validation state group 
        /// 
        public const string GroupValidation = "ValidationStates";
        #endregion GroupValidation
 
        #region GroupWatermark
        ///  
        /// Unwatermarked state 
        /// 
        public const string StateUnwatermarked = "Unwatermarked"; 

        /// 
        /// Watermarked state
        ///  
        public const string StateWatermarked = "Watermarked";
 
        ///  
        /// Watermark state group
        ///  
        public const string GroupWatermark = "WatermarkStates";
        #endregion GroupWatermark

        #region GroupChecked 

        public const string StateChecked = "Checked"; 
        public const string StateUnchecked = "Unchecked"; 
        public const string StateIndeterminate = "Indeterminate";
 
        public const string GroupCheck = "CheckStates";

        #endregion
 
        #region GroupCurrent
        ///  
        /// Regular state 
        /// 
        public const string StateRegular = "Regular"; 

        /// 
        /// Current state
        ///  
        public const string StateCurrent = "Current";
 
        ///  
        /// Current state group
        ///  
        public const string GroupCurrent = "CurrentStates";
        #endregion GroupCurrent

        #region GroupInteraction 
        /// 
        /// Display state 
        ///  
        public const string StateDisplay = "Display";
 
        /// 
        /// Editing state
        /// 
        public const string StateEditing = "Editing"; 

        ///  
        /// Interaction state group 
        /// 
        public const string GroupInteraction = "InteractionStates"; 
        #endregion GroupInteraction


        #region GroupSort 
        /// 
        /// Unsorted state 
        ///  
        public const string StateUnsorted = "Unsorted";
 
        /// 
        /// Sort Ascending state
        /// 
        public const string StateSortAscending = "SortAscending"; 

        ///  
        /// Sort Descending state 
        /// 
        public const string StateSortDescending = "SortDescending"; 

        /// 
        /// Sort state group
        ///  
        public const string GroupSort = "SortStates";
        #endregion GroupSort 
 
        #region DataGridRow
 
        public const string DATAGRIDROW_stateAlternate = "Normal_AlternatingRow";
        public const string DATAGRIDROW_stateMouseOver = "MouseOver";
        public const string DATAGRIDROW_stateMouseOverEditing = "MouseOver_Unfocused_Editing";
        public const string DATAGRIDROW_stateMouseOverEditingFocused = "MouseOver_Editing"; 
        public const string DATAGRIDROW_stateMouseOverSelected = "MouseOver_Unfocused_Selected";
        public const string DATAGRIDROW_stateMouseOverSelectedFocused = "MouseOver_Selected"; 
        public const string DATAGRIDROW_stateNormal = "Normal"; 
        public const string DATAGRIDROW_stateNormalEditing = "Unfocused_Editing";
        public const string DATAGRIDROW_stateNormalEditingFocused = "Normal_Editing"; 
        public const string DATAGRIDROW_stateSelected = "Unfocused_Selected";
        public const string DATAGRIDROW_stateSelectedFocused = "Normal_Selected";

        #endregion DataGridRow 

        #region DataGridRowHeader 
 
        public const string DATAGRIDROWHEADER_stateMouseOver = "MouseOver";
        public const string DATAGRIDROWHEADER_stateMouseOverCurrentRow = "MouseOver_CurrentRow"; 
        public const string DATAGRIDROWHEADER_stateMouseOverEditingRow = "MouseOver_Unfocused_EditingRow";
        public const string DATAGRIDROWHEADER_stateMouseOverEditingRowFocused = "MouseOver_EditingRow";
        public const string DATAGRIDROWHEADER_stateMouseOverSelected = "MouseOver_Unfocused_Selected";
        public const string DATAGRIDROWHEADER_stateMouseOverSelectedCurrentRow = "MouseOver_Unfocused_CurrentRow_Selected"; 
        public const string DATAGRIDROWHEADER_stateMouseOverSelectedCurrentRowFocused = "MouseOver_CurrentRow_Selected";
        public const string DATAGRIDROWHEADER_stateMouseOverSelectedFocused = "MouseOver_Selected"; 
        public const string DATAGRIDROWHEADER_stateNormal = "Normal"; 
        public const string DATAGRIDROWHEADER_stateNormalCurrentRow = "Normal_CurrentRow";
        public const string DATAGRIDROWHEADER_stateNormalEditingRow = "Unfocused_EditingRow"; 
        public const string DATAGRIDROWHEADER_stateNormalEditingRowFocused = "Normal_EditingRow";
        public const string DATAGRIDROWHEADER_stateSelected = "Unfocused_Selected";
        public const string DATAGRIDROWHEADER_stateSelectedCurrentRow = "Unfocused_CurrentRow_Selected";
        public const string DATAGRIDROWHEADER_stateSelectedCurrentRowFocused = "Normal_CurrentRow_Selected"; 
        public const string DATAGRIDROWHEADER_stateSelectedFocused = "Normal_Selected";
 
        #endregion DataGridRowHeader 

 
        /// 
        /// Use VisualStateManager to change the visual state of the control.
        /// 
        ///  
        /// Control whose visual state is being changed.
        ///  
        ///  
        /// true to use transitions when updating the visual state, false to
        /// snap directly to the new visual state. 
        /// 
        /// 
        /// Ordered list of state names and fallback states to transition into.
        /// Only the first state to be found will be used. 
        /// 
        public static void GoToState(Control control, bool useTransitions, params string[] stateNames) 
        { 
            if (stateNames == null)
            { 
                return;
            }

            foreach (string name in stateNames) 
            {
                if (VisualStateManager.GoToState(control, name, useTransitions)) 
                { 
                    break;
                } 
            }
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK