Exemplo n.º 1
0
        private void AnimateOnSearchBarActive()
        {
            #region AnimateButton
            //ThicknessAnimation ta = new ThicknessAnimation();
            //ta.From = SearchButton.Margin;
            //double x = Grid_SearchBar.ActualWidth-SearchButton.ActualWidth;
            //System.Windows.Thickness thickness = new System.Windows.Thickness(x, 0, 0, 0);
            //ta.To = thickness;
            //ta.Duration = TimeSpan.FromSeconds(0.5f);
            //SearchButton.BeginAnimation(MarginProperty, ta);
            #endregion

            #region AnimateSearchBar
            if (SearchBar.ActualWidth == Grid_SearchBar.ActualWidth)
            {
                return;
            }
            DoubleAnimation da = new DoubleAnimation();
            da.From       = SearchBar.ActualWidth;
            da.To         = Grid_SearchBar.ActualWidth;
            da.Completed += Da_Completed;
            da.Duration   = TimeSpan.FromSeconds(0.3f);
            SearchBar.BeginAnimation(WidthProperty, da);

            #endregion
        }
        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            DoubleAnimation da = new DoubleAnimation
            {
                From     = 100,
                To       = Container.ActualWidth,
                Duration = TimeSpan.FromSeconds(0.3)
            };

            da.Completed += Da_Completed;
            SearchBar.BeginAnimation(WidthProperty, da);
        }