Tive Value Binding.

Editors for WPF Forum

Posted 6 years ago by Zorina Pop
Version: 12.2.0572


I'm implementing a Timer app in .Net 4.0. The user will set a start and a stop time/date in which certain processes will happen.

The app has a Repeat timer every X periode and depending on that I need to change the UI of the timer.

My problem is when iI have Repeat everyday between TimeX and TimeY I don't know how to bind the value chosen moade TwoWay.

Have in mind that the whole ap needs to be pure MVVM and no code behind.

.cs ViewModel code:

 public TimeSpan SelectedTime
                string t = Time.Value.ToString().PadLeft(6, '0');
                string tstr = string.Format("{0}{1}:{2}{3}:{4}{5}", t[0], t[1], t[2], t[3], t[4], t[5]);
                    TimeSpan.TryParseExact(tstr, "g", CultureInfo.InvariantCulture, out _selectedTime);
                catch (Exception)
                    _selectedTime = DateTime.Now.TimeOfDay;
                return _selectedTime;

                string time = value.ToString("hhmmss");
                long timeToLong;
                long.TryParse(time, out timeToLong);
                Time.Value = new PValue(timeToLong, 0);
                RaisePropertyChanged(() => SelectedTime);

 .xaml View code:

                    <editors:DateTimeEditBox Name="TPicker" Grid.Row="3" Width="100" HorizontalAlignment="Left" AllowDrop="False"
                                             Format="{Binding Path=TimeFormat}" Margin="5" ToolTip="{Binding Path=TimeFormat}"
                                             DropDownButtonVisibility="Collapsed" VerticalAlignment="Center" DateValue="{Binding Path=SelectedTime, Mode=TwoWay}"
                                             DropDownButtonInactiveVisibility="Collapsed" SpinnerVisibility="Visible">

The time that I obtain in the SelectedTime property is smth like: "12:34:56" but in the UI nothing is loaded.
Could you please help me with this? BTW I'm new at using Actipro and wpf in general.


Best regards,


Comments (3)

Posted 6 years ago by Zorina Pop

PS Sorry for the bad title for the thread. I meant Time not Tive.

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA

Hello, one thing is that you are using our DateTimeEditBox but you are binding to a TimeSpan, which I expect would not work.  You should probably try using TimeSpanEditBox instead.

Actipro Software Support

Posted 6 years ago by Zorina Pop

Thank you very much that helped a lot... I have to change certain things but it looks great so far.

The latest build of this product (v2018.1 build 0675) was released 14 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.