This is a migrated thread and some comments may be shown as answers.

StringFormat not formatting on new Items

2 Answers 171 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Dev
Top achievements
Rank 1
Dev asked on 09 May 2012, 07:44 PM
I have a radCarousel bound to an ObservableCollection. On the carousel item I have label with: 
<Label FontSize="18" Padding="0" Content="{Binding Effective_Date, StringFormat=d}" />

When I set the ItemSource to the ObservableCollection the Date is formatted correctly. However when I add an Item to the collection manually the date on the new Item is not formatted. It displays the full datetime string instead of just the date. How can I fix this?

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 10 May 2012, 03:38 PM
Hi,

I have investigated the described scenario. The problem is related to the Label that you use in the ItemsTemplate. Please use a TextBlock instead and the format will be applied once the new item is added to the collection.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dev
Top achievements
Rank 1
answered on 11 May 2012, 06:48 PM
That seemed to work however it would require me to "Unstyle" the text box so there was no border and background. Because I wanted the new Item in the correct sort order, I ended up doing an orderby on my collection and rebinding it to the item source which also did the trick. 

Thanks for your help.
Tags
Carousel
Asked by
Dev
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Dev
Top achievements
Rank 1
Share this question
or