Refreshing a label control

8 posts, 1 answers
  1. Edward
    Edward avatar
    45 posts
    Member since:
    Aug 2005

    Posted 28 Jun 2012 Link to this post

    Hi

    I have a loop which updates the Content property of a Telerik label.  Its kind of a status label. The problem is that it does not get refreshed when the Content property is updated with a new value.

    Q: How can I refresh this control?

    Hope you can help. Thanks anyway.

    Edward
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 28 Jun 2012 Link to this post

    Hello,

     May I ask you to provide a little bit more information on the matter? For example how have you defined the label and how do you change its content?

    Greetings,
    Didie
    the Telerik team

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

  3. Edward
    Edward avatar
    45 posts
    Member since:
    Aug 2005

    Posted 28 Jun 2012 Link to this post

    Hi

    The Label is defined in Xaml:

    <telerik:Label Name="tbStatusMessage" Margin="10,10,10,0"  Content="TextBlock" VerticalAlignment="Top" FontSize="14" />

    And I have this code that updates the label:


    private void AddMessage(string pMessage, int pCount)
           {
               //todo: this does not repaint !
     
               if (pCount < 0)
                   tbStatusMessage.Content += Environment.NewLine + pMessage;
               else
                   tbStatusMessage.Content += Environment.NewLine + String.Format(pMessage + " (Aantal: {0})", pCount);
           }
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 28 Jun 2012 Link to this post

    Hi,

     Thank you for the code snippets. I have created a test project but I were not able to get any problem refreshing the content of the Label.

    Would you please check the sample attached and let me know how I could reproduce the issue?

    All the best,
    Didie
    the Telerik team

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

  5. Edward
    Edward avatar
    45 posts
    Member since:
    Aug 2005

    Posted 28 Jun 2012 Link to this post

    I could have been more clear :)

    The code is in a popin and it does something like this

    AddMessage("Passes loaded",2)
    ..

    ..20 x AddMessage ..

    ..
    AddMessage("Passes loaded",2) 


    Thread.Sleep(2000);  // wait so user can see the last messages - removing this will not help
    ClosePopInCode();


    The problem is that the popin closes without showing the status messages.  I think adding the messages is too fast. It does not have the time to update the status text.  Is there a way to force an update on the TextBox ? like  tbStatusMessage.Update()

















  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 28 Jun 2012 Link to this post

    Hi,

    I am not sure that I understand this line: "Is there a way to force an update on the TextBox ?". May I ask you to send me a little sample project that demonstrates the problem? That way we could debug it locally and advise you better. 

    Regards,
    Didie
    the Telerik team

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

  7. Edward
    Edward avatar
    45 posts
    Member since:
    Aug 2005

    Posted 02 Jul 2012 Link to this post

    Well, with  "Is there a way to force an update on the TextBox ?".  In Windows you have an application.processMessage which forces controls to be updated. Its not there is SL and thats the problem i'm having.

    I think it has nothing to do with the Telerik controls but with the SL inner workings. If there is nothing that pops up in your mind I think I close this thread (dont want to waste your time) because its more of a SL thing. 
  8. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 02 Jul 2012 Link to this post

    Hello,

     Indeed, I would recommend you to check the general Silverlight forums where it is more likely to find a solution to this particular problem.

    All the best,
    Didie
    the Telerik team

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

Back to Top