-1
我有一個包含問題和答案的猜謎的文本文件。如何從文本文件中讀取字符串並將其拆分爲4個單選按鈕? (WPF)
m1 | mcq | Which of the following is an animal | table#cat#keyboard#water
m2 | mcq | which of the following is a programming language |C++#water#Air#Phone
m3 | mcq | which is the prime number | 3#4#8#10
我迄今爲止的進展:
string[] lines = File.ReadAllLines(path);
string[] line = lines[0].Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
string QuizQuestion = line[2].Trim();
string[] QuestionChoice = line[3].Split(new string[] { "#" }, StringSplitOptions.RemoveEmptyEntries);
textBox.Text = QuizQuestion;
foreach(?)
{
}
我試着用foreach循環,使我的單選按鈕,像答案選擇,但我不知道如何着手。我已插入標籤和文本框我的單選按鈕嘗試哪一個成功了,但是我不
我忘了提這是WPF。單選按鈕沒有.Text。我也嘗試做radiobutton.Test B4手 – NaviHam
呵呵謝謝了很多,測試的另一個會議結束後,我去查這個網站https://msdn.microsoft.com/en-us/library/system.windows.controls.radiobutton (v = vs.110).aspx,並發現單選按鈕使用了「內容」。非常感謝 – NaviHam