コード例 #1
0
        /// <summary>
        /// Commands a visual state change.
        /// </summary>
        /// <param name="stateName">Name of the state.</param>
        /// <param name="useTransitions">if set to <c>true</c> use transitions.</param>
        /// <returns>
        ///   <b>true</b> is the transition succeed; otherwise, <b>false</b>
        /// </returns>
        protected bool GoToVisualState(string stateName, bool useTransitions = true)
        {
            var args    = new VisualStateChangeEventArgs(stateName, useTransitions);
            var handler = this.VisualStateChangeEvent;

            if (handler != null)
            {
                handler(this, args);
            }

            return(args.Succeed);
        }
コード例 #2
0
 /// <summary>
 /// Called when a visual state changeis commanded from the viewmodel.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="SrkToolkit.Mvvm.VisualStateChangeEventArgs"/> instance containing the event data.</param>
 protected virtual void OnVisualStateChange(object sender, VisualStateChangeEventArgs e)
 {
     e.Succeed = VisualStateManager.GoToState(this, e.StateName, e.UseTransitions);
 }