Inheritance: DependencyObject, IVisualStateGroup
Exemplo n.º 1
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot              = (ContosoCookbook.Common.LayoutAwarePage) this.FindName("pageRoot");
            itemsViewSource       = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("itemsViewSource");
            PageAppBar            = (Windows.UI.Xaml.Controls.AppBar) this.FindName("PageAppBar");
            LeftCommands          = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("LeftCommands");
            RightCommands         = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("RightCommands");
            BragButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("BragButton");
            PinRecipeButton       = (Windows.UI.Xaml.Controls.Button) this.FindName("PinRecipeButton");
            flipView              = (Windows.UI.Xaml.Controls.FlipView) this.FindName("flipView");
            portraitFlipView      = (Windows.UI.Xaml.Controls.FlipView) this.FindName("portraitFlipView");
            snappedFlipView       = (Windows.UI.Xaml.Controls.FlipView) this.FindName("snappedFlipView");
            backButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/CollectionSummaryPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("CollectionViewSource");
            LayoutRoot           = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot");
            OrientationStates    = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates");
            Full             = (Windows.UI.Xaml.VisualState) this.FindName("Full");
            Fill             = (Windows.UI.Xaml.VisualState) this.FindName("Fill");
            Portrait         = (Windows.UI.Xaml.VisualState) this.FindName("Portrait");
            Snapped          = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
            ScrollViewer     = (Windows.UI.Xaml.Controls.ScrollViewer) this.FindName("ScrollViewer");
            CategoryPanel    = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("CategoryPanel");
            HeaderTitlePanel = (Windows.UI.Xaml.Controls.Grid) this.FindName("HeaderTitlePanel");
            ItemGridView     = (Windows.UI.Xaml.Controls.GridView) this.FindName("ItemGridView");
            ItemListView     = (Windows.UI.Xaml.Controls.ListView) this.FindName("ItemListView");
            Title            = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("Title");
            Image            = (Windows.UI.Xaml.Controls.Image) this.FindName("Image");
            DescriptionText  = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("DescriptionText");
            BackButton       = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton");
            PageTitle        = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle");
        }
Exemplo n.º 3
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///SearchResultsPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot              = (SimpleSearchProvider.Common.LayoutAwarePage) this.FindName("pageRoot");
            resultsViewSource     = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("resultsViewSource");
            filtersViewSource     = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("filtersViewSource");
            resultsPanel          = (Windows.UI.Xaml.Controls.Grid) this.FindName("resultsPanel");
            noResultsTextBlock    = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("noResultsTextBlock");
            typicalPanel          = (Windows.UI.Xaml.Controls.Grid) this.FindName("typicalPanel");
            snappedPanel          = (Windows.UI.Xaml.Controls.Grid) this.FindName("snappedPanel");
            resultsListView       = (Windows.UI.Xaml.Controls.ListView) this.FindName("resultsListView");
            filtersItemsControl   = (Windows.UI.Xaml.Controls.ItemsControl) this.FindName("filtersItemsControl");
            resultsGridView       = (Windows.UI.Xaml.Controls.GridView) this.FindName("resultsGridView");
            backButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            resultText            = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("resultText");
            queryText             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("queryText");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            ResultStates          = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ResultStates");
            ResultsFound          = (Windows.UI.Xaml.VisualState) this.FindName("ResultsFound");
            NoResultsFound        = (Windows.UI.Xaml.VisualState) this.FindName("NoResultsFound");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
Exemplo n.º 4
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///HomePage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (_8Tracks.Common.LayoutAwarePage)this.FindName("pageRoot");
            groupedItemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("groupedItemsViewSource");
            passwordPrompt = (Windows.UI.Xaml.Controls.Grid)this.FindName("passwordPrompt");
            itemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("itemGridView");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            loginText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("loginText");
            loginBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("loginBox");
            passwordText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("passwordText");
            passwordBox = (Windows.UI.Xaml.Controls.PasswordBox)this.FindName("passwordBox");
            doneButton = (Windows.UI.Xaml.Controls.Button)this.FindName("doneButton");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://wikipediaquerytoolxaml/Files/SplitPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("CollectionViewSource");
            LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot");
            OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates");
            Full = (Windows.UI.Xaml.VisualState)this.FindName("Full");
            Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill");
            Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait");
            PortraitDetail = (Windows.UI.Xaml.VisualState)this.FindName("PortraitDetail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            SnappedDetail = (Windows.UI.Xaml.VisualState)this.FindName("SnappedDetail");
            PrimaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("PrimaryColumn");
            TitlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("TitlePanel");
            ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView");
            ItemDetail = (Windows.UI.Xaml.Controls.ContentControl)this.FindName("ItemDetail");
            ItemStackPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("ItemStackPanel");
            BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton");
            PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle");
        }
Exemplo n.º 6
0
        private void ListBoxCompressionHandling(ListView targetlistbox)
        {
            VisualStateGroup vgroup = new VisualStateGroup();
            var border=VisualTreeHelper.GetChild(targetlistbox,0);
            var scrollViewer=VisualTreeHelper.GetChild(border,0);
            // ListBox の初めに定義されている ScrollViewerを取り出す 
            ScrollViewer ListViewScrollViewer = (ScrollViewer)scrollViewer;

            // Visual State はコントロールテンプレートの常に最上位に定義されている 
            FrameworkElement element = (FrameworkElement)VisualTreeHelper.GetChild(ListViewScrollViewer, 0);
            // Visual State を取り出しその中から 縦横Compression のVisualStateを取り出す 
            foreach (VisualStateGroup group in VisualStateManager.GetVisualStateGroups(element))
                if (group.Name == "VerticalCompression") vgroup = group;

            //縦横Compressionの状態が変わった時のイベントハンドラ 
            vgroup.CurrentStateChanging += (s,e) =>
            {
                switch (e.NewState.Name) 
                { 
                    case "CompressionTop":
                        break; 
                    case "CompressionBottom":
                        break; 
                    case "NoVerticalCompression": 
                        break; 
                    default: 
                        break; 
                } 


            };
        } 
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/DetailPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("CollectionViewSource");
            LayoutRoot           = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot");
            OrientationStates    = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates");
            Full           = (Windows.UI.Xaml.VisualState) this.FindName("Full");
            Fill           = (Windows.UI.Xaml.VisualState) this.FindName("Fill");
            Portrait       = (Windows.UI.Xaml.VisualState) this.FindName("Portrait");
            Snapped        = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
            FlipView       = (Windows.UI.Xaml.Controls.FlipView) this.FindName("FlipView");
            ApplicationBar = (Windows.UI.Xaml.Controls.ApplicationBar) this.FindName("ApplicationBar");
            NextPanel      = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("NextPanel");
            NextButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("NextButton");
            PreviousButton = (Windows.UI.Xaml.Controls.Button) this.FindName("PreviousButton");
            HomeButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("HomeButton");
            BackButton     = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton");
            PageTitle      = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle");
        }
Exemplo n.º 8
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///HomePage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot = (_8Tracks.Common.LayoutAwarePage) this.FindName("pageRoot");
            groupedItemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("groupedItemsViewSource");
            passwordPrompt         = (Windows.UI.Xaml.Controls.Grid) this.FindName("passwordPrompt");
            itemGridView           = (Windows.UI.Xaml.Controls.GridView) this.FindName("itemGridView");
            itemListView           = (Windows.UI.Xaml.Controls.ListView) this.FindName("itemListView");
            backButton             = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            loginText             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("loginText");
            loginBox              = (Windows.UI.Xaml.Controls.TextBox) this.FindName("loginBox");
            passwordText          = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("passwordText");
            passwordBox           = (Windows.UI.Xaml.Controls.PasswordBox) this.FindName("passwordBox");
            doneButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("doneButton");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/CollectionSummaryPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("CollectionViewSource");
            LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot");
            OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates");
            Full = (Windows.UI.Xaml.VisualState)this.FindName("Full");
            Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill");
            Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            ScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("ScrollViewer");
            CategoryPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("CategoryPanel");
            HeaderTitlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("HeaderTitlePanel");
            ItemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("ItemGridView");
            ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView");
            Title = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("Title");
            Image = (Windows.UI.Xaml.Controls.Image)this.FindName("Image");
            DescriptionText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("DescriptionText");
            BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton");
            PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle");
        }
Exemplo n.º 10
0
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            host = UIMixin.FindAncestor<WizardHost>(this);

            var vssHost = host.GetChildOfType<Border>();
            var stateGroups = VisualStateManager.GetVisualStateGroups(vssHost);
            sizeModes = stateGroups.First(stateGroup => stateGroup.Name == "SizeModes");
            UpdateState();
            sizeModes.CurrentStateChanged += SizeModesOnCurrentStateChanged;
        }
        protected override bool GoToStateCore(Control control, FrameworkElement stateGroupsRoot, string stateName, VisualStateGroup group, VisualState state, bool useTransitions)
        {
            if ((group == null) || (state == null))
            {
                return false;
            }

            if (control == null)
            {
                control = new ContentControl();
            }

            return base.GoToStateCore(control, stateGroupsRoot, stateName, group, state, useTransitions);
        }
Exemplo n.º 12
0
        // For most of the UWP controls, this custom VisualStateManager is injected to prevent the default Windows
        // VSM from handling states which the Forms VSM is already managing.
        // The exception are the controls which are built on TextBox (SearchBar, Entry, Editor); there's a UWP
        // bug wherein the GoToStateCore override for those controls is never called (Item 10976357 in VSTS)
        // So until that's resolved, the FormsTextBox control is doing that work as best it can.

        protected override bool GoToStateCore(Control control, FrameworkElement templateRoot, string stateName,
                                              Windows.UI.Xaml.VisualStateGroup @group, Windows.UI.Xaml.VisualState state, bool useTransitions)
        {
            // If this custom VSM is in play, it's because the control is using the Forms VSM or the user has disabled
            // legacy color handling. Either way, we may need to prevent the Windows VSM from transitioning to the new
            // state. So we intercept the transition here.

            if (ShouldIntercept(control, state, stateName))
            {
                return(false);
            }

            return(base.GoToStateCore(control, templateRoot, stateName, @group, state, useTransitions));
        }
Exemplo n.º 13
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///AddStation.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Metarma.Common.LayoutAwarePage)this.FindName("pageRoot");
            RootPanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("RootPanel");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            StationIDText = (Windows.UI.Xaml.Controls.TextBox)this.FindName("StationIDText");
        }
Exemplo n.º 14
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///BasicPage1.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (metroui.Common.LayoutAwarePage)this.FindName("pageRoot");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
Exemplo n.º 15
0
 /// <summary>
 /// Removes all or a specific logger from a VisualStateGroup
 /// </summary>
 /// <param name="vsg">specify visual state group to remove logger from that group only</param>
 public static void StopLogging(VisualStateGroup vsg = null)
 {
     if (vsg == null)
     {
         foreach (var key in _loggerDict.Keys)
         {
             key.CurrentStateChanged -= Vsg_CurrentStateChanged;
         }
         _loggerDict.Clear();
     }
     else
     {
         if(!_loggerDict.ContainsKey(vsg)) return;
         vsg.CurrentStateChanged -= Vsg_CurrentStateChanged;
         _loggerDict.Remove(vsg);
     }
 }
Exemplo n.º 16
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _rootGrid = GetTemplateChild("RootGrid") as Windows.UI.Xaml.Controls.Grid;
            if (_rootGrid != null)
            {
                var stateGroups = WVisualStateManager.GetVisualStateGroups(_rootGrid).ToList();
                _DeleteButtonVisibleStateGroups = stateGroups.SingleOrDefault(sg => sg.Name == "ButtonStates");
                if (_DeleteButtonVisibleStateGroups != null)
                {
                    _DeleteButtonVisibleState = _DeleteButtonVisibleStateGroups.States.SingleOrDefault(s => s.Name == "ButtonVisible");
                }
                UpdateClearButtonVisible();
            }

            _scrollViewer = GetTemplateChild("ContentElement") as ScrollViewer;
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///LogonPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot              = (StreetFoo.Client.UI.Common.LayoutAwarePage) this.FindName("pageRoot");
            backButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (ChampionshipOrganizer.Common.LayoutAwarePage)this.FindName("pageRoot");
            itemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("itemsViewSource");
            flipView = (Windows.UI.Xaml.Controls.FlipView)this.FindName("flipView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///Auto Viewer.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Metro_Media_Streamer.Common.LayoutAwarePage)this.FindName("pageRoot");
            image11 = (Windows.UI.Xaml.Controls.Image)this.FindName("image11");
            image22 = (Windows.UI.Xaml.Controls.Image)this.FindName("image22");
            b11 = (Windows.UI.Xaml.Controls.Button)this.FindName("b11");
            b22 = (Windows.UI.Xaml.Controls.Button)this.FindName("b22");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
        private static bool TryGetState(FrameworkElement element, string stateName, out VisualStateGroup group, out VisualState state)
        {
            group = null;
            state = null;

            foreach (VisualStateGroup group2 in VisualStateManager.GetVisualStateGroups(element))
            {
                foreach (VisualState state2 in group2.States)
                {
                    if (state2.Name == stateName)
                    {
                        group = group2;
                        state = state2;
                        return true;
                    }
                }
            }

            return false;
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://matchit/Files/GroupedCollectionPage.xaml"));

            GroupedCollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("GroupedCollectionViewSource");
            LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot");
            OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates");
            Full = (Windows.UI.Xaml.VisualState)this.FindName("Full");
            Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill");
            Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView");
            ItemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("ItemGridView");
            BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton");
            PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle");
        }
Exemplo n.º 22
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            pageRoot              = (MovieBrowser.Common.LayoutAwarePage) this.FindName("pageRoot");
            itemsViewSource       = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("itemsViewSource");
            flipView              = (Windows.UI.Xaml.Controls.FlipView) this.FindName("flipView");
            backButton            = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton");
            pageTitle             = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates");
            FullScreenLandscape   = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape");
            Filled             = (Windows.UI.Xaml.VisualState) this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait");
            Snapped            = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
        }
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (Device.Idiom == TargetIdiom.Phone)
            {
                // If we're on the phone, we need to grab this from the template
                // so we can manually handle its background when focused
                _borderElement = (Border)GetTemplateChild("BorderElement");
            }

            _rootGrid = (Windows.UI.Xaml.Controls.Grid)GetTemplateChild("RootGrid");
            if (_rootGrid != null)
            {
                var stateGroups = WVisualStateManager.GetVisualStateGroups(_rootGrid).ToList();
                _DeleteButtonVisibleStateGroups = stateGroups.SingleOrDefault(sg => sg.Name == "ButtonStates");
                if (_DeleteButtonVisibleStateGroups != null)
                {
                    _DeleteButtonVisibleState = _DeleteButtonVisibleStateGroups.States.SingleOrDefault(s => s.Name == "ButtonVisible");
                }
            }
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///SampleProfile.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            txtName = (Windows.UI.Xaml.Controls.TextBox)this.FindName("txtName");
            cboCountry = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboCountry");
            cboJob = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboJob");
            cboBirthdayDay = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboBirthdayDay");
            cboBirthdayMonth = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboBirthdayMonth");
            cboBirthdayYear = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboBirthdayYear");
            cboHobby = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboHobby");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///DetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (TheBellyofAuthority.Common.LayoutAwarePage)this.FindName("pageRoot");
            LikeButton = (Windows.UI.Xaml.Controls.Button)this.FindName("LikeButton");
            flipView = (Windows.UI.Xaml.Controls.FlipView)this.FindName("flipView");
            contentView = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("contentView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            UserPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("UserPanel");
            LabelBox = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("LabelBox");
            UserBox = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("UserBox");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
Exemplo n.º 26
0
        public void InitializeComponent()
        {
            if (_contentLoaded)
            {
                return;
            }

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/GroupedCollectionPage.xaml"));

            GroupedCollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("GroupedCollectionViewSource");
            LayoutRoot        = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot");
            OrientationStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates");
            Full          = (Windows.UI.Xaml.VisualState) this.FindName("Full");
            Fill          = (Windows.UI.Xaml.VisualState) this.FindName("Fill");
            Portrait      = (Windows.UI.Xaml.VisualState) this.FindName("Portrait");
            Snapped       = (Windows.UI.Xaml.VisualState) this.FindName("Snapped");
            AppBar        = (Windows.UI.Xaml.Controls.ApplicationBar) this.FindName("AppBar");
            ItemListView  = (Windows.UI.Xaml.Controls.ListView) this.FindName("ItemListView");
            ItemGridView  = (Windows.UI.Xaml.Controls.GridView) this.FindName("ItemGridView");
            BackButton    = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton");
            PageTitle     = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle");
            SearchTextBox = (Windows.UI.Xaml.Controls.TextBox) this.FindName("SearchTextBox");
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/DetailPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("CollectionViewSource");
            LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot");
            OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates");
            Full = (Windows.UI.Xaml.VisualState)this.FindName("Full");
            Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill");
            Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            FlipView = (Windows.UI.Xaml.Controls.FlipView)this.FindName("FlipView");
            ApplicationBar = (Windows.UI.Xaml.Controls.ApplicationBar)this.FindName("ApplicationBar");
            NextPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("NextPanel");
            NextButton = (Windows.UI.Xaml.Controls.Button)this.FindName("NextButton");
            PreviousButton = (Windows.UI.Xaml.Controls.Button)this.FindName("PreviousButton");
            HomeButton = (Windows.UI.Xaml.Controls.Button)this.FindName("HomeButton");
            BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton");
            PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle");
        }
Exemplo n.º 28
0
        protected override void OnApplyTemplate()
        {
            MasterPresenter = (ContentPresenter) GetTemplateChild("MasterFrame");
            DetailPresenter = (Border) GetTemplateChild("DetailPresenter");
            AdaptiveStates = (VisualStateGroup) GetTemplateChild("AdaptiveStates");
            AdaptiveStates.CurrentStateChanged += OnCurrentStateChanged;
            DetailFrame = GetTemplateChild("DetailFrame") as Frame;

            if (DetailFrame == null) return;

            DetailFrame.Name = "DetailFrame";

            DetailPresenter.Child = DetailFrame;
            DetailFrame.Navigated += OnNavigated;

            if (DetailFrame.CurrentSourcePageType == null)
            {
                DetailFrame.Navigate(BlankPageType);
            }
            //else
            //{
            //    DetailFrame.BackStack.Insert(0, new PageStackEntry(BlankPageType, null, null));
            //}

            _extendSplitView= this.GetFirstAncestorOfType<ExtendSplitView>();
        }
Exemplo n.º 29
0
 /// <summary>
 /// Log state changes in a VisualStateGroup
 /// </summary>
 /// <param name="vsg">VisualStateGroup</param>
 /// <param name="logOutput">Output logger action (eg.: Debug.WriteLine)</param>
 public static void LogVisualStateChanges(VisualStateGroup vsg, Action<string> logOutput)
 {
     _loggerDict.Add(vsg, logOutput);
     vsg.CurrentStateChanged += Vsg_CurrentStateChanged;
 }
 public VisualStateGroupEvents(VisualStateGroup This)
 {
     this.This = This;
 }
Exemplo n.º 31
0
        void UpdateOnColor()
        {
            if (!(Cell is SwitchCell switchCell))
            {
                return;
            }

            var color = switchCell.OnColor == Color.Default
                                ? _defaultOnColor
                                : new SolidColorBrush(switchCell.OnColor.ToWindowsColor());

            var nativeSwitch = FrameworkElementExtensions.GetFirstDescendant <ToggleSwitch>(this);

            // change fill color in switch rectangle
            var rects = nativeSwitch.GetDescendantsByName <Windows.UI.Xaml.Shapes.Rectangle>("SwitchKnobBounds");

            foreach (var rect in rects)
            {
                rect.Fill = color;
            }

            // change color in animation on PointerOver
            var grid = nativeSwitch.GetFirstDescendant <Windows.UI.Xaml.Controls.Grid>();
            var gridVisualStateGroups = Windows.UI.Xaml.VisualStateManager.GetVisualStateGroups(grid);

            Windows.UI.Xaml.VisualStateGroup vsGroup = null;
            foreach (var visualGroup in gridVisualStateGroups)
            {
                if (visualGroup.Name == "CommonStates")
                {
                    vsGroup = visualGroup;
                    break;
                }
            }
            if (vsGroup == null)
            {
                return;
            }

            Windows.UI.Xaml.VisualState vState = null;
            foreach (var visualState in vsGroup.States)
            {
                if (visualState.Name == "PointerOver")
                {
                    vState = visualState;
                    break;
                }
            }
            if (vState == null)
            {
                return;
            }

            var visualStates = vState.Storyboard.Children;

            foreach (ObjectAnimationUsingKeyFrames item in visualStates)
            {
                if ((string)item.GetValue(Storyboard.TargetNameProperty) == "SwitchKnobBounds")
                {
                    item.KeyFrames[0].Value = color;
                    break;
                }
            }
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///SearchResultsPage1.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (Fashionizer2.Common.LayoutAwarePage)this.FindName("pageRoot");
            resultsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("resultsViewSource");
            filtersViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("filtersViewSource");
            resultsPanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("resultsPanel");
            noResultsTextBlock = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("noResultsTextBlock");
            typicalPanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("typicalPanel");
            snappedPanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("snappedPanel");
            resultsListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("resultsListView");
            filtersItemsControl = (Windows.UI.Xaml.Controls.ItemsControl)this.FindName("filtersItemsControl");
            resultsGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("resultsGridView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            resultText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("resultText");
            queryText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("queryText");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            ResultStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ResultStates");
            ResultsFound = (Windows.UI.Xaml.VisualState)this.FindName("ResultsFound");
            NoResultsFound = (Windows.UI.Xaml.VisualState)this.FindName("NoResultsFound");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
Exemplo n.º 33
0
        protected virtual bool GoToStateCore(Control control, IFrameworkElement templateRoot, string stateName, VisualStateGroup group, VisualState state, bool useTransitions)
        {
#if IS_UNO
            if (_trace.IsEnabled)
            {
                _trace.WriteEvent(
                    TraceProvider.StoryBoard_GoToState,
                    EventOpcode.Send,
                    new[] {
                    control.GetType()?.ToString(),
                    control?.GetDependencyObjectId().ToString(),
                    stateName,
                    useTransitions ? "UseTransitions" : "NoTransitions"
                }
                    );
            }
#endif

            var originalState = group.CurrentState;

            if (VisualState.Equals(originalState, state))
            {
                // Already in the right state
                return(true);
            }

            RaiseCurrentStateChanging(group, originalState, state);

            // The visual state group must not keep a hard reference to the control,
            // otherwise it may leak.
            var wr = Uno.UI.DataBinding.WeakReferencePool.RentWeakReference(this, control);

            group.GoToState(
                control,
                state,
                originalState,
                useTransitions,
                () =>
            {
                var innerControl = wr?.Target as Control;

                if (innerControl != null)
                {
                    RaiseCurrentStateChanged(group, originalState, state);
                }
            }
                );

            return(true);
        }
Exemplo n.º 34
0
 protected virtual bool GoToStateCore(Control control, FrameworkElement templateRoot, string stateName, VisualStateGroup group, VisualState state, bool useTransitions)
 => GoToStateCorePrivateBaseImplementation(control, group, state, useTransitions);
 /// <summary>
 /// Initializes a new instance of the <see cref="VisualStateInfo"/> class.
 /// </summary>
 /// <param name="frameworkElement">
 /// The framework element.
 /// </param>
 /// <param name="group">
 /// The group.
 /// </param>
 /// <param name="visualState">
 /// The visual state.
 /// </param>
 public VisualStateInfo(FrameworkElement frameworkElement, VisualStateGroup group, VisualState visualState)
 {
     this.FrameworkElement = frameworkElement;
     this.VisualStateGroup = group;
     this.VisualState = visualState;
 }
 protected override bool GoToStateCore(Control control, FrameworkElement templateRoot, string stateName, VisualStateGroup group, VisualState state, bool useTransitions)
 {
     if (control == null)
     {
         control = new ContentControl();
     }
     if ((group == null) || (state == null))
     {
         return false;
     }
     if (!GetUseFluidLayout(group))
     {
         return base.GoToStateCore(control, templateRoot, stateName, group, state, useTransitions);
     }
     VisualState currentState = GetCurrentState(group);
     if (currentState == state)
     {
         if (!useTransitions && (LayoutTransitionStoryboard != null))
         {
             StopAnimations();
         }
         return true;
     }
     SetCurrentState(group, state);
     Storyboard layoutStoryboard = ExtractLayoutStoryboard(state);
     List<OriginalLayoutValueRecord> originalLayoutValues = GetOriginalLayoutValues(group);
     if (originalLayoutValues == null)
     {
         originalLayoutValues = new List<OriginalLayoutValueRecord>();
         SetOriginalLayoutValues(group, originalLayoutValues);
     }
     if (!useTransitions)
     {
         if (LayoutTransitionStoryboard != null)
         {
             StopAnimations();
         }
         base.GoToStateCore(control, templateRoot, stateName, group, state, useTransitions);
         SetLayoutStoryboardProperties(control, templateRoot, layoutStoryboard, originalLayoutValues);
         return true;
     }
     if ((layoutStoryboard.Children.Count == 0) && (originalLayoutValues.Count == 0))
     {
         return base.GoToStateCore(control, templateRoot, stateName, group, state, useTransitions);
     }
     templateRoot.UpdateLayout();
     List<FrameworkElement> targets = FindTargetElements(control, templateRoot, layoutStoryboard, originalLayoutValues, MovingElements);
     Dictionary<FrameworkElement, Rect> rectsOfTargets = GetRectsOfTargets(targets, MovingElements);
     Dictionary<FrameworkElement, double> oldOpacities = GetOldOpacities(control, templateRoot, layoutStoryboard, originalLayoutValues, MovingElements);
     if (LayoutTransitionStoryboard != null)
     {
         templateRoot.LayoutUpdated -= ExtendedVisualStateManager.control_LayoutUpdated;
         StopAnimations();
         templateRoot.UpdateLayout();
     }
     base.GoToStateCore(control, templateRoot, stateName, group, state, useTransitions);
     SetLayoutStoryboardProperties(control, templateRoot, layoutStoryboard, originalLayoutValues);
     templateRoot.UpdateLayout();
     Dictionary<FrameworkElement, Rect> newRects = GetRectsOfTargets(targets, null);
     MovingElements = new List<FrameworkElement>();
     foreach (FrameworkElement element in targets)
     {
         if (rectsOfTargets[element] != newRects[element])
         {
             MovingElements.Add(element);
         }
     }
     foreach (FrameworkElement element2 in oldOpacities.Keys)
     {
         if (!MovingElements.Contains(element2))
         {
             MovingElements.Add(element2);
         }
     }
     WrapMovingElementsInCanvases(MovingElements, rectsOfTargets, newRects);
     VisualTransition transition = FindTransition(group, currentState, state);
     templateRoot.LayoutUpdated += ExtendedVisualStateManager.control_LayoutUpdated;
     LayoutTransitionStoryboard = CreateLayoutTransitionStoryboard(transition, MovingElements, oldOpacities);
     LayoutTransitionStoryboard.Completed += (sender, args) =>
     {
         templateRoot.LayoutUpdated -= ExtendedVisualStateManager.control_LayoutUpdated;
         StopAnimations();
     };
     LayoutTransitionStoryboard.Begin();
     return true;
 }
Exemplo n.º 37
0
        VisualStateCache PseudoDisable(Control control)
        {
            if (VisualTreeHelper.GetChildrenCount(control) == 0)
            {
                control.ApplyTemplate();
            }

            WVisualStateManager.GoToState(control, "Disabled", true);

            var rootElement = (FrameworkElement)VisualTreeHelper.GetChild(control, 0);

            var cache = new VisualStateCache();
            IList <WVisualStateGroup> groups = WVisualStateManager.GetVisualStateGroups(rootElement);

            WVisualStateGroup common = null;

            foreach (var group in groups)
            {
                if (group.Name == "CommonStates")
                {
                    common = group;
                }
                else if (group.Name == "FocusStates")
                {
                    cache.FocusStates = group;
                }
                else if (cache.FocusStates != null && common != null)
                {
                    break;
                }
            }

            if (cache.FocusStates != null)
            {
                groups.Remove(cache.FocusStates);
            }

            if (common != null)
            {
                foreach (WVisualState state in common.States)
                {
                    if (state.Name == "Normal")
                    {
                        cache.Normal = state;
                    }
                    else if (state.Name == "Pressed")
                    {
                        cache.Pressed = state;
                    }
                    else if (state.Name == "PointerOver")
                    {
                        cache.PointerOver = state;
                    }
                }

                if (cache.Normal != null)
                {
                    common.States.Remove(cache.Normal);
                }
                if (cache.Pressed != null)
                {
                    common.States.Remove(cache.Pressed);
                }
                if (cache.PointerOver != null)
                {
                    common.States.Remove(cache.PointerOver);
                }
            }

            return(cache);
        }
 /// <summary>
 /// Locate the transition that VisualStateManager will use to animate the change, so that the layout animation can match the duration and ease.
 /// </summary>
 /// <param name="group">The group in which the transition is taking place</param>
 /// <param name="previousState">The state that you are coming from</param>
 /// <param name="state">The state you are going to</param>
 /// <returns>The transition</returns>
 private static VisualTransition FindTransition(VisualStateGroup group, VisualState previousState, VisualState state)
 {
     string str = (previousState != null) ? previousState.Name : string.Empty;
     string str2 = (state != null) ? state.Name : string.Empty;
     int num = -1;
     VisualTransition transition = null;
     if (group.Transitions != null)
     {
         foreach (VisualTransition transition2 in group.Transitions)
         {
             int num2 = 0;
             if (transition2.From == str)
             {
                 num2++;
             }
             else if (!string.IsNullOrEmpty(transition2.From))
             {
                 continue;
             }
             if (transition2.To == str2)
             {
                 num2 += 2;
             }
             else if (!string.IsNullOrEmpty(transition2.To))
             {
                 continue;
             }
             if (num2 > num)
             {
                 num = num2;
                 transition = transition2;
             }
         }
     }
     return transition;
 }