Setup
- Community edition (v2.9), Visual Studio 2015 update 3
xaml:
<xctk:DateTimePicker Value="{Binding EndDate}" Visibility="{Binding dtpVisible, Converter={StaticResource BoolToVisConverter}}"/>
*Note* - the BoolToVisConverter is the msdn converter resource
<BooleanToVisibilityConverter x:Key="BoolToVisConverter"/>
Going from Hidden to Visible state is stable. Just crashes when going from Collapsed to Visible.
The exception is the same but where it occurs tends to change.
Exceptions seen
System.ExecutionEngineException was unhandled
Message: An unhandled exception of type 'System.ExecutionEngineException' occurred in WindowsBase.dll
System.ExecutionEngineException was unhandled
Message: An unhandled exception of type 'System.ExecutionEngineException' occurred in PresentationCore.dll
System.ExecutionEngineException was unhandled
Message: An unhandled exception of type 'System.ExecutionEngineException' occurred in mscorlib.dll
Comments: ** Comment from web user: BoucherS **
Hi,
I cannot reproduce the issue in v2.9. Here's my sample :
```
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisConverter" />
</Window.Resources>
<StackPanel>
<Button Content="TEST"
Click="Button_Click" />
<xctk:DateTimePicker Value="{Binding EndDate}"
Visibility="{Binding dtpVisible, Converter={StaticResource BoolToVisConverter}}" />
</StackPanel>
</Window>
```
```
public partial class MainWindow : Window, INotifyPropertyChanged
{
public MainWindow()
{
InitializeComponent();
this.DataContext = this;
this.EndDate = new DateTime( 2016, 7, 21 );
this.dtpVisible = false;
}
public DateTime EndDate
{
get
{
return _endDate;
}
set
{
_endDate = value;
this.RaisePropertyChanged( "EndDate" );
}
}
private DateTime _endDate;
public bool dtpVisible
{
get
{
return _visible;
}
set
{
_visible = value;
this.RaisePropertyChanged( "dtpVisible" );
}
}
private bool _visible;
private void Button_Click( object sender, RoutedEventArgs e )
{
this.dtpVisible = !this.dtpVisible;
}
#region Event Raisers
protected void RaisePropertyChanged( string propertyName )
{
if( PropertyChanged != null )
{
PropertyChanged( this, new PropertyChangedEventArgs( propertyName ) );
}
}
#endregion
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
```