The method "ClearValue" on Span object is gone in Q3

2 posts, 0 answers
  1. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 17 Nov 2011 Link to this post

    Code like the following does not work anymore:
    private void HtmlDataProvider_SetupDocument(object sender, SetupDocumentEventArgs e)
    {
        foreach (Span span in e.Document.EnumerateChildrenOfType<Span>())
        {
            span.ClearValue(Span.FontSizeProperty);
            span.ClearValue(Span.FontFamilyProperty);
            span.ClearValue(Span.FontStyleProperty);
            span.ClearValue(Span.FontWeightProperty);
        }
    }

    I have replaced it with the following:
    private void HtmlDataProvider_SetupDocument(object sender, SetupDocumentEventArgs e)
    {
        foreach (Span span in e.Document.EnumerateChildrenOfType<Span>())
        {
            if (span.Style != null)
            {
                span.Style.ClearPropertyValue(Span.FontSizeProperty);
                span.Style.ClearPropertyValue(Span.FontFamilyProperty);
                span.Style.ClearPropertyValue(Span.FontStyleProperty);
                span.Style.ClearPropertyValue(Span.FontWeightProperty);
            }
        }
    }


    Is this the correct way to solve the issue?

    Best regards,
    /Henrik
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 22 Nov 2011 Link to this post

    Hello Henrik,

    We had made the ClearValue method internal, as we have thought that it is not used. We will make sure to make it public again in the internal build next week.

    For the time being, you can use the following approach, which has the same effect:

    private void HtmlDataProvider_SetupDocument(object sender, SetupDocumentEventArgs e)
    {
        foreach (Span span in e.Document.EnumerateChildrenOfType<Span>())
        {
            span.GetStyleProperty(Span.FontSizeProperty).ClearValue();
            span.GetStyleProperty(Span.FontFamilyProperty).ClearValue();
            span.GetStyleProperty(Span.FontStyleProperty).ClearValue();
            span.GetStyleProperty(Span.FontWeightProperty).ClearValue();
        }

    Kind regards,
    Iva Toteva
    the Telerik team

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

  3. DevCraft banner
Back to Top