无效的绑定路径' MyStatic' :物业' MyStatic'无法找到类型' CreatePage'

时间:2017-01-20 20:44:45

标签: c# xaml uwp

所以我一直在为我的问题寻找解决方案。我似乎无法绑定到我的models文件夹中的observableCollection。我可以在其中添加项目,并在以后的体育场中使用一些C#代码检索这些项目。但我似乎无法绑定到名为CreatePage的页面中的项目。

我不断收到此消息:无效的绑定路径'问题列表' :财产问题清单'无法找到类型' CreatePage'。

带有observableCollection的类:

public partial class MyStatic
{
        static MyStatic()
        {
            Questionlist = new ObservableCollection<QuestionList>();            
        }
        public static ObservableCollection<QuestionList> Questionlist;
    }
public class QuestionList
{
    public string Question { get; set; }
    public string Answer { get; set; }
    public string Delete { get; set; }
    public string Correct { get; set; }
    public string Wrong { get; set; }
    public string UserAnswer { get; set; }
}

这是我的Xaml:

<ScrollViewer Grid.Row="4"
                  Grid.ColumnSpan="2"
                  Margin="20,10"
                  MaxWidth="650">
        <RelativePanel>
            <ListView Name="Questionviewlist"
                      ItemsSource="{x:Bind Questionlist}">
                <ListView.ItemTemplate>
                    <DataTemplate x:DataType="data:QuestionList">
                        <TextBlock Name="Questionview"
                                   Text="{x:Bind Question}"
                                   TextWrapping="Wrap"
                                   FontFamily="Arial Rounded MT Bold"
                                   FontWeight="Bold"
                                   Foreground="Brown"/>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <ListView Name="Answerviewlist"
                      RelativePanel.AlignHorizontalCenterWithPanel="True"
                      ItemsSource="{x:Bind Questionlist}">
                <ListView.ItemTemplate>
                    <DataTemplate x:DataType="data:QuestionList">
                        <TextBlock Name="Answerview"
                           Text="{x:Bind Answer}"
                                   FontFamily="Arial Rounded MT Bold"
                                   FontWeight="Bold"
                                   Foreground="Brown"/>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <ListView Name="Deleteviewlist"
                      RelativePanel.AlignRightWithPanel="True"
                      ItemsSource="{x:Bind Questionlist}"
                      IsItemClickEnabled="True"
                      ItemClick="Deleteviewlist_ItemClick">
                <ListView.ItemTemplate>
                    <DataTemplate x:DataType="data:QuestionList">
                        <TextBlock Name="Deleteview"
                                   Text="{x:Bind Delete}"
                                   TextWrapping="WrapWholeWords"
                                   Foreground="#FFB57C"
                                   FontStyle="Italic"
                                   FontFamily="Arial Rounded MT Bold"/>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </RelativePanel>
    </ScrollViewer>

0 个答案:

没有答案