StringFormat not formatting on new Items

3 posts, 1 answers
  1. Tom
    Tom avatar
    38 posts
    Member since:
    Mar 2007

    Posted 09 May 2012 Link to this post

    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. Answer
    Dimitrina avatar
    3769 posts

    Posted 10 May 2012 Link to this post


    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.

    the Telerik team

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

  3. Tom
    Tom avatar
    38 posts
    Member since:
    Mar 2007

    Posted 11 May 2012 Link to this post

    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.
Back to Top