Grids for WPF Forum

Posted 6 years ago by Neil Larson
Version: 18.1.0672

Having trouble using the Actipro TimeSpanEditBox as a propertyEditor.


The editor is displayed with the correct format, but the value is always 0:00:00:00. 

Im sure its something obvious but I cant spot it. If I remove the editor template, it all works correctly using the default editor.

I followed one of the examples to get this far, heres the code.

   <propgrid:PropertyEditor PropertyName="TimeFromShowStart">
            <editors:TimeSpanEditBox Format="h:mm:ss.ff" />


      private TimeSpan _TimeFromShowStart;
      [DisplayName("Time From Start")]
      [Description("Time from the start of the show this command executes. Timing accurate to 1/100th of a second. Format HH:MM:SS.SS")]
      //[Editor(typeof(StringPropertyEditor), typeof(PropertyEditor))]
      public TimeSpan TimeFromShowStart
         get { return _TimeFromShowStart; }
            if (_TimeFromShowStart == value)

            DefaultChangeFactory.Current.OnChanging(this, nameof(TimeFromShowStart), _TimeFromShowStart, value, "TimeFromShowStart Changed");
            var oldval = _TimeFromShowStart;
            _TimeFromShowStart = value;
            RaisePropertyChanged(() => TimeFromShowStart, oldval, value, true);


Btw, the search on the web page for the forums always returns 0 results.

Comments (2)

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

Hi Neil,

There are a lot of properties that can be bound onto the edit box, most importantly the Value.  I think that's what you're missing here. 

This is our default template:

<DataTemplate x:Key="TimeSpanValueTemplate">
	<editors:TimeSpanEditBox Value="{Binding Value, Mode=TwoWay}" 
		BorderThickness="0" IsReadOnly="{Binding IsReadOnly}" 
		CommitTriggers="{Binding ValuePropertyEditor.CommitTriggers}"
		HasPopup="{Binding ValuePropertyEditor.HasPopup}"
		IsArrowKeyPartNavigationEnabled="{Binding ValuePropertyEditor.IsArrowKeyPartNavigationEnabled}"
		IsEditable="{Binding ValuePropertyEditor.IsEditable}"
		IsNullAllowed="{Binding ValuePropertyEditor.IsNullAllowed}"
		PlaceholderText="{Binding ValuePropertyEditor.PlaceholderText}"
		SpinnerVisibility="{Binding ValuePropertyEditor.SpinnerVisibility}"
		SpinWrapping="{Binding ValuePropertyEditor.SpinWrapping}"
		TextAlignment="{Binding ValuePropertyEditor.TextAlignment}"
		DefaultValue="{Binding ValuePropertyEditor.DefaultValue}"
		Format="{Binding ValuePropertyEditor.Format}"
		LargeChange="{Binding ValuePropertyEditor.LargeChange}"
		Maximum="{Binding ValuePropertyEditor.Maximum}"
		Minimum="{Binding ValuePropertyEditor.Minimum}"
		SmallChange="{Binding ValuePropertyEditor.SmallChange}"

Instead of what you're doing though, you might just want to create an instance of TimeSpanPropertyEditor for that PropertyName so the default template is used.  Then just set its Format property and that will get used by the default template.

Actipro Software Support

Posted 6 years ago by Neil Larson

Argh.... Value="{Binding Path=Value, Mode=TwoWay}"  I wonder why I didn't see it in the sample code. Late night coding sleepy strikes again.



The latest build of this product (v24.1.2) was released 27 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.