Populate a listBox with XML values for current day, and the next three days? [closed]

VialiaSic

New Member
Possible Duplicate:
Based on date, get todays and the next two days values from XML? I have asked some questions earlier, and thanks to excellent help from stackoverflow, i have solved a lot of the main issues. Thank you all!I am extremely sorry if my questions are stupid, but i have tried to google as much as i can before asking here at stackoverflow. I also have a working page where i can get specific prayer times and populate textblocks.See this link and my marked question with the solution. There i use public timespan in the class and the var query:How to make an if statement to show xml attribute based on current timeI am still working on the muslim PrayerTime app, and want to populate a listBox with todays+the next 3 days prayer times. DateTime myDay = DateTime.Now; XDocument loadedCustomData = http://stackoverflow.com/questions/10497531/XDocument.Load("WimPrayerTime.xml"); var filteredData = http://stackoverflow.com/questions/10497531/from c in loadedCustomData.Descendants("PrayerTime") where c.Attribute("Day").Value =http://stackoverflow.com/questions/10497531/= myDay.Day.ToString() && c.Attribute("Month").Value =http://stackoverflow.com/questions/10497531/= myDay.Month.ToString() select new PrayerTime() { Fajr = c.Attribute("Fajr").Value, Soloppgang = c.Attribute("Soloppgang").Value, Zohr = c.Attribute("Zohr").Value, }; listBox1.ItemsSource = filteredData;my Class is:public class Prayertime{ public string Fajr { get; set; } public string Sunrise { get; set; } public string Zohr { get; set; }}my local XML file (always included in the app it self)<PrayerTime Day ="30" Month="4" Fajr="07:00" Sunrise="09:00" Zuhr="14:00"/><PrayerTime Day ="1" Month="5" Fajr="07:05" Sunrise="09:05" Zuhr="14:05"/><PrayerTime Day ="2" Month="5" Fajr="07:10" Sunrise="09:10" Zuhr="14:10"/>First of all, how to change this code to show me a list of today plus the next three days?where c.Attribute("Day").Value =http://stackoverflow.com/questions/10497531/= myDay.Day.ToString()Or should i make one query for each day, DateTime NextDay = DateTime.Now.AddDays(1) and so on? How to i populate the same listBox with three or four different querys like this?Can i just repeat this:listBox1.ItemsSource = filteredData1;listBox1.ItemsSource = filteredData2;listBox1.ItemsSource = filteredData3;Also, what to do when the month changes? For example, if the date is 30 and month is 4 next day will be value 1 and month should then show 5?Last but not least.. when showing the information i want the listBox to show it like:Monday 30.04.2012Fajr 07:00Sunrise 09:00Zuhr 14:00Tuesday 01.05.2012Fajr 07:05Sunrise 09:10Zuhr 14:10where i have a fixed spacing between the Attribute name and value, and the date/day above.Thank you very much to everyone who takes the time to read, and huge thanks to everyone who answers:)
 
Back
Top