English 中文(简体)
收件日期列表日期选择器
原标题:Bind DatePicker to List of Dates

可能无关紧要, 但我有一个具有日期的 XamDataChaart 类XAx轴的系统。 我设法将日期采集器绑在图表中可用的日期范围, 但我真的需要绑定在图表中绘制的具体日期列表 。

<DatePicker x:Name="statsDatePicker" DisplayDateStart="{Binding Path=ActualMinimumValue.Date, ElementName=xAxisPath, Mode=OneWay, StringFormat={0:d}}" DisplayDateEnd="{Binding ElementName=xAxisPath, Path=ActualMaximumValue.Date, Mode=OneWay, StringFormat={0:d}}" SelectedDateChanged="DatePicker_SelectedDateChanged" />

我发现你可以提供一份停电日期清单,但人们如何从我拥有的众多日期中取出,并将其变成一系列我不拥有的日期? 或者,有没有办法向摘除日期的人提供我拥有的日期而不是我没有的日期?

最佳回答

也许像这样的东西吗?

DateTime end = DateTime.MaxValue;
DateTime start = DateTime.MinValue;
List<DateTime> datesIHave= new List<DateTime>();
datesIHave.Add(DateTime.Now);
List<DateTime> allDates = Enumerable.Range(0, 1 + end.Subtract(start).Days).Select(offset => start.AddDays(offset)).ToList();
List<DateTime> blackoutDates = (from a in allDates 
                                where !datesIHave.Contains(a)
                                select a).ToList();
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签