Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF DatePicker throws exception when changing month
    primarykey
    data
    text
    <p>Ok I have this project I'm working on in WPF (Visual C# 2010 Express), and I have a few DatePickers that are bound to DateTime-properties. Now if I just open up the "picker" and start changing months immediately there is no problem. However, if I select a date and then try to change the month, I get the following Exception:</p> <blockquote> <p>Element does not exist or it is virtualized; use VirtualizedItem Pattern if it is supported.</p> </blockquote> <p>The stack trace only shows:</p> <blockquote> <p>[External Code]<br /> my method that opens the dialog which contains the DatePickers (amongst other things)<br /> [External Code]</p> </blockquote> <p>If the properties are nullable or not doesn't seem to make a difference, and can't find a single result on any of the major search engines on the above exception.</p> <p><strong>XAML</strong></p> <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded"&gt; &lt;Grid&gt; &lt;DatePicker SelectedDate="{Binding TheDate}" x:Name="datePicker1" /&gt; &lt;Button Content="Button" x:Name="button1" Click="button1_Click" /&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p><strong>Code Behind</strong></p> <pre><code> class TheClass { public DateTime TheDate { get; set; } } public MainWindow() { theClass = new TheClass(); theClass.TheDate = DateTime.Now; InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { this.DataContext = theClass; } private void button1_Click(object sender, RoutedEventArgs e) { System.Windows.MessageBox.Show(theClass.TheDate.ToString()); } </code></pre> <p>Anyone ever seen this behaviour before or have any other ideas? I'm far from a WPF-expert and have honestly no idea what might be causing this or where to start looking..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload