I am making a Windows 8 application in VS2012 and am trying to associate a list of objects (maps) with a user control that will display two lines. Here is my code for a user control on one page:
<FlipView x:Name="cardView"/> <FlipView.ItemTemplate> <DataTemplate> <local:TileControl x:Name="cardTile" Width="600" Height="400" QuestionText="{Binding Value.question}" AnswerText="{Binding Value.answer}"/> </DataTemplate> </FlipView.ItemTemplate> </FlipView>
This is set in the C # code behind:
cardView.ItemsSource = Storage.content.Decks[currentDeck].Cards;
The TileControl user control has the following variables:
public string questionTextStr { get; set; } public string answerTextStr { get; set; } public string QuestionText { get { return questionTextStr; } set { questionTextStr = value; questionText.Text = value;
There is an error in the list of errors: “The property“ Flashdeck.TileControl.AnswerText ”could not be set. And this also applies to QuestionText. The application will compile and run, but if it fails to open the page using the user control. What am I doing wrong to give an error and fail? Thanks.
Edit: Additional information about the class of decks and cards. Deck:
public class Deck { public List<Card> Cards { get; set; } public bool flagged { get; set; } public Deck() { } public Deck(List<Card> iCards) { Cards = iCards; flagged = false; } public Deck(List<Card> iCards, bool iFlag) { Cards = iCards; flagged = iFlag; } }
map:
public class Card { public string question { get; set; } public string answer { get; set; } public bool flagged { get; set; } public Card() { } public Card(string iQ, string iA) { question = iQ; answer = iA; flagged = false; } }
source share