MaterialDesignInXAML / MaterialDesignInXamlToolkit

Google's Material Design in XAML & WPF, for C# & VB.Net.
http://materialdesigninxaml.net
MIT License
15.17k stars 3.43k forks source link

Problem with TimePicker in Dialogbox #410

Closed HansRom closed 3 years ago

HansRom commented 8 years ago

We are trying to use a timepicker in a dialogbox (The same as in sample 3 from your demo), but when we open the Timepicker the time is always empty. We found out that in the code:

private void SetSelectedTime(bool beCautious = false)
        {
            if (!string.IsNullOrEmpty(_textBox?.Text))
            {
                ParseTime(_textBox.Text, t =>
                {
                    if (!beCautious || DateTimeToString(t) == _textBox.Text)
                        SetCurrentValue(SelectedTimeProperty, t);
                });
            }
            else
            {
                SetCurrentValue(SelectedTimeProperty, null);
            }
        }

_textBox is always "Nothing". When we use exactly the same code without the: "DialogHost.Show", the time is correctly filled in. And _textBox is not nothing but contains the correct time. How can we fix this?

JamesIrish commented 8 years ago

Ditto suffering from something similar. Fairly standard TimePicker within a dialog null's the value it's bound to when displaying. Sets the value correctly though.

<materialDesign:TimePicker Width="100" Margin="5 0" materialDesign:HintAssist.Hint="Time" SelectedTime="{Binding ParameterValue, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>
JamesIrish commented 8 years ago

* NuGet package version 2.0.0.638 I've actually got the same issue outside of a dialog popup (but within a DialogHost if that makes any odds)

Keboo commented 3 years ago

This appears to be fixed in the 4.2.1 release