Help with using Timespan control

Jul 22, 2011 at 4:25 PM

Hello,

I have some issues with using TimespanPicker control.

After adding the control to XAML I have following runtime error:

AG_E_PARSER_BAD_TYPE [Line: 117 Position: 22].

That line points to the place where TimespanPicker is located.

  1. I added references to Coding4Fun.Phone.Controls, Coding4Fun.Phone.Controls.Toolkit, Coding4Fun.Phone.Site.Controls
  2. On the XAML itself I used following namespace: xmlns:cf4Toolkit="clr-namespace:Coding4Fun.Phone.Controls.Toolkit;assembly=Coding4Fun.Phone.Controls.Toolkit"
  3. Control itself looks as the following on the page: <cf4Toolkit:TimeSpanPicker Max="0:0:6" Step="0:0:2"/>

Suppose this error can be related to some unresolved references, but I'm not sure.

Could you please advice what can be wrong here?

Thanks ahead,

Taras

Coordinator
Jul 22, 2011 at 5:15 PM

TimeSpans are not serializable so doing what you're doing won't work.  What you need to do is set a public var in the code behind like:

public

TimeSpan TimeSpan5Min { get { return TimeSpan.FromMinutes(5); } }

 Then in XAML, you'd reference it like:

<

c4fToolkit:TimeSpanPicker Max="{Binding TimeSpan30Min}" Step="{Binding TimeSpan5Min}"/>

 

Jul 25, 2011 at 9:02 AM

Thanks for the feedback!

However as I expected - that's not an serialization issue.

I've added following code and it still fails with the same message.

ViewModel:

        public TimeSpan DurationMax
        {
            get { return TimeSpan.FromHours(24); }
        }

        public TimeSpan DurationStep
        {
            get { return TimeSpan.FromMinutes(1); }
        }

XAML:

<cf4Toolkit:TimeSpanPicker Max="{Binding DurationMax}" Step="{Binding DurationStep}"/>

Any ideas?

Thanks ahead,
Taras

Coordinator
Jul 25, 2011 at 5:57 PM

Any chance you could create a small repo (you can create a bug)?  Right now stuff looks like it should work but there could actually be something else wrong.

One thing you'll have to do as well is reference the Silverlight Toolkit in the actual project as well.  This control leverages stuff from that kit.  I wouldn't cause the error you're seeing but something to note.

Jul 25, 2011 at 7:55 PM
On the XAML itself I used following namespace: xmlns:cf4Toolkit="clr-namespace:Coding4Fun.Phone.Controls.Toolkit;assembly=Coding4Fun.Phone.Controls.Toolkit"

Control itself looks as the following on the page: <cf4Toolkit:TimeSpanPicker Max="0:0:6" Step="0:0:2"/>

I've tried exactly what you put in here in a fresh project to which I added the Coding4Fun toolkit using Nuget, and it works just fine as it is. I don't see any problem.

Coordinator
Jul 26, 2011 at 1:41 AM

Which is why I am inclined to say there is something wrong with that page / why I want repo.

@tchypurka, does it happen when you comment out the timespan picker?

Coordinator
Jul 26, 2011 at 1:42 AM

does the parse error happen when you go to the page that has the actual picker or when you click on the timespan picker?

Jul 29, 2011 at 9:28 AM

Hello all again,

I don't need the answer to the question anymore. But I tried all your suggestions and propositions and it were not working.

Suppose that might be because I have installed Beta of Mango Tools.

Thanks everybody trying to help me!

Coordinator
Jul 29, 2011 at 10:46 PM

@tchypurka this does work in Mango tooling.  can you create a bug and give me a repo to test agianst?