windows8標準動畫樣本這個簡單的程式展示了如何使用api(Windows.UI.Core動畫度量。AnimationMetrics進入原始參數確定動畫在窗戶動畫圖書館。這些資訊能夠協助開發人員的應用和應用程式框架來建立動畫符合視窗和其他程式使用窗戶動畫圖書館。這個示範了該方法涉及以下的情景:•在一個列表添加一個項目•使螢幕上新的一頁public sealed partial class ScenarioList : Page
{
// A pointer back to the main page which is used to gain access to the input and output frames and their content.
MainPage rootPage = null;
public ScenarioList()
{
InitializeComponent();
}
#region Template-Related Code - Do not remove
void Scenarios_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (Scenarios.SelectedItem != null)
{
rootPage.NotifyUser("", NotifyType.StatusMessage);
ListBoxItem selectedListBoxItem = Scenarios.SelectedItem as ListBoxItem;
SuspensionManager.SessionState["SelectedScenario"] = selectedListBoxItem.Name;
if (rootPage.InputFrame != null && rootPage.OutputFrame != null)
{
// Load the input and output pages for the current scenario into their respective frames.
rootPage.DoNavigation(Type.GetType(typeof(ScenarioList).Namespace + "." + "ScenarioInput" + ((Scenarios.SelectedIndex + 1).ToString())), rootPage.InputFrame);
rootPage.DoNavigation(Type.GetType(typeof(ScenarioList).Namespace + "." + "ScenarioOutput" + ((Scenarios.SelectedIndex + 1).ToString())), rootPage.OutputFrame);
}
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = e.Parameter as MainPage;
Scenarios.SelectionChanged += new SelectionChangedEventHandler(Scenarios_SelectionChanged);
// Starting scenario is the first or based upon a previous selection.
ListBoxItem startingScenario = null;
if (SuspensionManager.SessionState.ContainsKey("SelectedScenario"))
{
String selectedScenarioName = SuspensionManager.SessionState["SelectedScenario"] as string;
startingScenario = this.FindName(selectedScenarioName) as ListBoxItem;
}
Scenarios.SelectedItem = startingScenario != null ? startingScenario : Scenario1;
}
#endregion
}
完整樣本
/Files/risk/windows8/動畫sample.rar