int buttonCount を使用して、別のページのリストボックスに追加しようとしています。public static int buttonCount = 15; を使用しました。ButtonCount int を MainPage.xaml.cs で使用できるようにしましたが、highScore.xaml.cs で使用しようとすると表示されないようです。私の名前空間は Potato_v2 で、クラスはページの名前です。これがgamePageの私のコードの一部です。
public static int buttonCount = 0;
string stringButtonCount = "";
Random rnd = new Random();
int count = 15;
void countDownTimerEvent(object sender, EventArgs e)
{
txtCountdown.Text = count + " Seconds Remaining";
if (count > 0)
{
count--;
}
if (count == 0)
{
countDownTimer.Stop();
NavigationService.Navigate(new Uri("/highScore.xaml", UriKind.Relative));
count = 15;
buttonCount = 0;
stringButtonCount = "";
}
}
MainPage のコード: 何らかの理由で最初の行を取得できません。
private void newToDoAddButton_Click(オブジェクト送信者, RoutedEventArgs e)
{
ToDoItem newToDo = new ToDoItem { ItemName = newToDoTextBox.Text };
ToDoItems.Add(buttonCount);
toDoDB.ToDoItems.InsertOnSubmit(newToDo);
}