Hi Guys,
I just updated to the latest version and have noticed that the DialogContentTemplate property in DialogHost produces a null error when switching the dialogcontent via content presenter.
I have reverted back to the old version which works correctly.Could you please have a look into this when you get the chance
@maciz84 can you post the stacktrace?
Give me a sec James, will post shortly
System.ArgumentNullException: Value cannot be null.
Parameter name: defaultOriginValue
at System.Windows.Media.Animation.DoubleAnimationBase.GetCurrentValue(Object defaultOriginValue, Object defaultDestinationValue, AnimationClock animationClock)
at System.Windows.Media.Animation.AnimationStorage.GetCurrentPropertyValue(AnimationStorage storage, DependencyObject d, DependencyProperty dp, PropertyMetadata metadata, Object baseValue)
at System.Windows.Media.Animation.AnimationStorage.EvaluateAnimatedValue(PropertyMetadata metadata, EffectiveValueEntry& entry)
at System.Windows.UIElement.EvaluateAnimatedValueCore(DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry& entry)
at System.Windows.DependencyObject.EvaluateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry, OperationType operationType)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
at System.Windows.StyleHelper.ClearTemplateChain(HybridDictionary[] instanceData, FrameworkElement feContainer, FrameworkContentElement fceContainer, List1 templateChain, FrameworkTemplate oldFrameworkTemplate)
at System.Windows.StyleHelper.ClearGeneratedSubTree(HybridDictionary[] instanceData, FrameworkElement feContainer, FrameworkContentElement fceContainer, FrameworkTemplate oldFrameworkTemplate)
at System.Windows.StyleHelper.DoTemplateInvalidations(FrameworkElement feContainer, FrameworkTemplate oldFrameworkTemplate)
at System.Windows.Controls.Control.OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.StyleHelper.InvalidateDependents(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, FrugalStructList1& dependents, Boolean invalidateOnlyContainer)
at System.Windows.StyleHelper.OnTriggerSourcePropertyInvalidated(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, DependencyPropertyChangedEventArgs changedArgs, Boolean invalidateOnlyContainer, FrugalStructList1& triggerSourceRecordFromChildIndex, FrugalMap& propertyTriggersWithActions, Int32 sourceChildIndex)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.OnDependencyPropertyChanged(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.OnSourceInvalidation(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.StyleHelper.InvalidateContainerDependents(DependencyObject container, FrugalStructList1& exclusionContainerDependents, FrugalStructList1& oldContainerDependents, FrugalStructList1& newContainerDependents)
at System.Windows.StyleHelper.DoStyleInvalidations(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle)
at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)
at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.Controls.TextBox.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.StyleHelper.ClearTemplateChain(HybridDictionary[] instanceData, FrameworkElement feContainer, FrameworkContentElement fceContainer, List1 templateChain, FrameworkTemplate oldFrameworkTemplate)
at System.Windows.StyleHelper.ClearGeneratedSubTree(HybridDictionary[] instanceData, FrameworkElement feContainer, FrameworkContentElement fceContainer, FrameworkTemplate oldFrameworkTemplate)
at System.Windows.StyleHelper.DoTemplateInvalidations(FrameworkElement feContainer, FrameworkTemplate oldFrameworkTemplate)
at System.Windows.Controls.ContentPresenter.OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.Controls.ContentPresenter.OnContentTemplateChanged(DataTemplate oldContentTemplate, DataTemplate newContentTemplate)
at System.Windows.Controls.ContentPresenter.OnContentTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.StyleHelper.InvalidateDependents(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, FrugalStructList1& dependents, Boolean invalidateOnlyContainer)
at System.Windows.StyleHelper.OnBindingValueInTemplateChanged(Object sender, BindingValueChangedEventArgs e)
at System.Windows.Data.BindingExpressionBase.ChangeValue(Object newValue, Boolean notify)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.OnSourcePropertyChanged(Object o, String propName)
at MS.Internal.Data.PropertyPathWorker.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
at System.Windows.WeakEventManager.ListenerList1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.ComponentModel.PropertyChangedEventManager.OnPropertyChanged(Object sender, PropertyChangedEventArgs args)
at MyApp.SearchViewModel.RaisePropertyChanged(String name) in C:Usersmark.couvarasDocumentsVisual Studio 2015ProjectsMyAppMyAppViewModelsSearchViewModel.vb:line 939
at KoalaBusiness.SearchViewModel.set_DisplayContent(Int32 value) in C:Usersmark.couvarasDocumentsVisual Studio 2015ProjectsMyAppMyAppViewModelsSearchViewModel.vb:line 158
at KoalaBusiness.SearchViewModel.ShowSearchFilterMethod() in C:Usersmark.couvarasDocumentsVisual Studio 2015ProjectsMyAppMyAppViewModelsSearchViewModel.vb:line 190
I hope that is what you are after?
hmmm....OK...can you please post a test repo for this with easy instructions to reproduce?
Is it OK if I attach a simple project?
OK...but please ensure everything is in place so it runs OK (I can manage a nuget package restore :smile: )
Hi James,
On further inspection I don't think it has anything to do with your control at all. It appears that one of my other libraries is causing the problem. I built a simple application (attached) with the latest version and no problems.
I will have to review my code to see what is causing the issue.
TestMaterialDesign.zip
strange that it works with the old one though?
Yes....strange...
Hi James,
Alas the problem is with the MaterialDesignFloatingHintBox inside the DialogTemplate. If I change to MaterialDesignTextBox no problems
TestMaterialDesign.zip
I have attached the project and you will see the issue much more clearly now. It is currently in the state to which it breaks. Simply change the textbox style inside the datatemplates to MaterialDesignTextBox and the problem goes away.
Hope you are able to fix this issue:)
Hey James,
I know it's late but could you confirm that you have received the updated attachment which produces the problem tomorrow or whenever you are next free.
Apologies again for the nagging 馃榾

Hi James,
I am truly sorry about that, I was trying to figure out the problem as we use their MVVM library. I have re-built the project without any other references or packages except for yours:)
Please have a go now and see the problem.
To reproduce please click the filter variant button on the right and you should see a dialog, then click the toggle on the right followed by the filter variant button again and it will crash.
As before simply change the style of the textbox inside the datetemplates to MaterialDesignTextBox from MaterialDesignFloatingHintTextBox and voila it will work?
Hey James,
Hope you are well?Please kindly let me know if today's sample is OK?
Have you tried using .DialogContentTemplateSelector?
I appreciate this may have worked in the past, but:
{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}
Bottom line, a TemplatedParent source should be used in a ControlTemplate _not_ a DataTemplate.
Hi James,
I appreciate your expert advice but I am still a novice so pardon my lack of efficiency. Could you possibly send me a few links on how I could achieve what you just said?
Do you have a sample or code snippet on how to use the dialogtemplateselector?
I think it would be useful to users to know how to use dialogtemplateselector as there is a need for switching dialog content in a real world application.
Whilst this is not the clean way of doing it as you said, I still don't get why it works when the textbox style is not a floating text box. Surely it is still a bug?
A bug, yes... In the WPF stack :)
I can't right now, but look up DataTemplateSelector. This is a standard WPF concept, I am just providing the ability to use one for dialog content.
If you still haven't got anywhere in a couple of days ping me back.
Thanks James, will read up today
Well I have followed your lead and used a DataTemplateSelector and it still crashes if a textbox style is MaterialDesignFloatingHintTextBox. I do get the below error now but still nothing:
Cannot animate the 'IsOpen' property on a 'ControlzEx.PopupEx' using a 'System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames'. For details see the inner exception.
If and when you do find the time try it out and see what happens. As you are a very busy man, I will not trouble you any further but will abandon the MaterialDesignFloatingHintTextBox use in my dialog content and stick with the MaterialDesignTextBox with labels on top of them :(
Hey... Please post your latest code sample AS A REPO... I'll take a look again as soon as I get chance. If it's a proper repo we can work thru it a lot easier.
I would like to see if we can figure this out.
Hi James,
Apologies I was away for the afternoon and only saw your message now. I will try and do that as I have never posted a REPO before so bear with me
Hi James,
I am not sure if I have done everything correctly but I have create a REPO. Github is confusing for someone like me, especially as I work by myself internally so this is awesome but tricky to use.
Anyway here is the link to the REPO
https://github.com/maciz84/MaterialDialogTest
It's a good learning experience for you!
OK, I'm gonna be travelling and stuff, I'll try and take a look next week.
True it most certainly is:)
Safe travels and hopefully we can get to the bottom of this soon. Take care
Hey James,
Early days in the week but please don't forget about me:)
Thanks James, I really appreciate your time in testing and identifying the problem. I look forward to the release
Not 100% fixed yet...closing in on it though.
Get in James!!! I am rooting for ya:)
Hi please report back once tested. I've got two bugs I'll roll into a 2.2.1 patch release.
To test it use _2.2.0-ci733_
Hi James,
I have tested this now and no problems at all. It is working perfectly and thank you so much for doing this I really appreciate your help as always:)
Most helpful comment
Hi James,
I have tested this now and no problems at all. It is working perfectly and thank you so much for doing this I really appreciate your help as always:)