本文整理匯總了C#中System.Windows.Controls.ListBoxItem.ApplyTemplate方法的典型用法代碼示例。如果您正苦於以下問題:C# ListBoxItem.ApplyTemplate方法的具體用法?C# ListBoxItem.ApplyTemplate怎麽用?C# ListBoxItem.ApplyTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Controls.ListBoxItem
的用法示例。
在下文中一共展示了ListBoxItem.ApplyTemplate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddHighScores
private void AddHighScores()
{
if (App.GameManager.GameData.Scores.Count > 0)
{
gridNoScores.Visibility = Visibility.Collapsed;
}
else
{
gridNoScores.Visibility = Visibility.Visible;
}
lstScores.Items.Clear();
for (int i = 0; i < App.GameManager.GameData.Scores.Count; i++)
{
Score s = App.GameManager.GameData.Scores[i];
ListBoxItem lbi = new ListBoxItem { Style = (Style)Resources["ListBoxItemStyle1"], DataContext = s };
lbi.ApplyTemplate();
lstScores.Items.Add(lbi);
}
}
示例2: leaderBoardManager_GetScoreCompleted
void leaderBoardManager_GetScoreCompleted(object sender, GetScoreCompletedEventArgs e)
{
grdProgress.Visibility = Visibility.Collapsed;
for (int i = 0; i < e.Scores.Length; i++)
{
e.Scores[i].Rank = i.ToString();
ListBoxItem lbi = new ListBoxItem();
lbi.Style = (Style)Resources["ListBoxItemStyle1"];
lbi.DataContext = e.Scores[i];
lbi.ApplyTemplate();
lbLeaderBoards.Items.Add(lbi);
}
}