简体   繁体   English

无法显示列表中的数据

[英]unable to display data from list

for some reason it isnt displaying the dates anything wrong with it? 由于某种原因,它不显示日期有什么问题吗?

IsolatedStorageSettings uc = IsolatedStorageSettings.ApplicationSettings;

public void load()
        {
            List<DateTime> List = new List<DateTime>();
            Schedule.ItemsSource = null;
            List<s> medicationList = (List<s>)uc["nList"];

            foreach(sn temp in List)
            {
                if (dateList.Contains(t.Date))
                {

                }
                else
                {                    
                    date.Add(t.Date);
                    Schedule.ItemsSource = List;
                }
            }
        }

Stupid mistake (Solution) 愚蠢的错误(解决方案)

<ListBox x:Name="Schedule" >
</ListBox>

The those and remove unnecessary codes 那些并删除不必要的代码

As a start, move lstboxSchedule.ItemsSource = dateList; 首先,移动lstboxSchedule.ItemsSource = dateList; outside the foreach. 在foreach之外。

Set breakpoints to see if/why the list produced is empty. 设置断点以查看是否/为什么生成的列表为空。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM