Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么我的列表框不显示任何数据?_C#_Mvvm_Windows Phone - Fatal编程技术网

C# 为什么我的列表框不显示任何数据?

C# 为什么我的列表框不显示任何数据?,c#,mvvm,windows-phone,C#,Mvvm,Windows Phone,这是我的XAML,在windows phone中,我正在使用MVVM将数据设置到页面,但在列表框中找不到任何数据 <ListBox Grid.Row="0" SelectionMode="Single" SelectedItem="{Binding CurrentSelectedEmployee, Mode=TwoWay}"> <ListBox.ItemTemplate> <DataTemplate> <

这是我的XAML,在windows phone中,我正在使用MVVM将数据设置到页面,但在列表框中找不到任何数据

<ListBox Grid.Row="0"  SelectionMode="Single" SelectedItem="{Binding CurrentSelectedEmployee, Mode=TwoWay}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding FirstName}"></TextBlock>
                    <TextBlock Width="5"></TextBlock>
                    <TextBlock Text="{Binding LastName}"></TextBlock>
                </StackPanel>
                <TextBlock Text="{Binding Description}" TextWrapping="Wrap"></TextBlock>
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

但我在第页找不到任何细节!,原因可能是什么?

您尚未为列表框的ItemsSource属性分配任何值

在您的XAML中

<ListBox Grid.Row="0" ItemsSource="{Binding Employees}" 
                     SelectionMode="Single" SelectedItem="{Binding CurrentSelectedEmployee, Mode=TwoWay}">

您尚未为列表框的ItemsSource属性分配任何值

在您的XAML中

<ListBox Grid.Row="0" ItemsSource="{Binding Employees}" 
                     SelectionMode="Single" SelectedItem="{Binding CurrentSelectedEmployee, Mode=TwoWay}">

不要将“OnpropertyChanged()”留空;“使用OnpropertyChanged(“员工”)而不是将“OnpropertyChanged()”留空;“改用OnpropertyChanged(“员工”)
<ListBox Grid.Row="0" ItemsSource="{Binding Employees}" 
                     SelectionMode="Single" SelectedItem="{Binding CurrentSelectedEmployee, Mode=TwoWay}">