Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4626372
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:24:38+00:00 2026-05-22T03:24:38+00:00

I have a TextBlock control and I am declaratively setting the Text property to

  • 0

I have a TextBlock control and I am declaratively setting the Text property to {loc:Translate}.

<TextBlock x:Name="Message" Text="{loc:Translate}" loc:TranslateExtension.Uid="myMessage"  />

During runtime, I update the Text property value to something else. I then need to reset it back to {loc:Translate}.

My question is, how can I programmatically set Text to {loc:Translate}?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:24:39+00:00Added an answer on May 22, 2026 at 3:24 am

    When a XAML processor processes a type node and member value that is a markup extension, it invokes the ProvideValue method of that markup extension and writes the result into the object graph or serialization stream. The XAML object writer passes service context to each such implementation through the serviceProvider parameter.

    tb.Text = new TranslateExtension().ProvideValue(null) as string;
    

    This should be it except that this is lacking a ‘proper’ IServiceProvider-parameter.

    In typical usage, the .NET Framework XAML Services and the implemented XAML object writers will provide a service provider to all value converter methods it invokes during XAML processing. However, for robustness, you should provide code paths for null values both for the service provider itself and for any requested service. Null values might occur if your markup extension is applied in some circumstance where the typical service support provided by a XAML parser infrastructure is not available.

    So depending on your extension implementation you could actually pass null to ProvideValue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a listbox control with following DataTemplate <DataTemplate x:Key=lb_Itemtemplate> <DockPanel> <TextBlock Text={Binding}
I have a TextBlock inside a limited-size control. If the text is too long
I have a data bound tab control: <TabControl ItemsSource={Binding Products} Name=ProductsTabControl> <TabControl.ItemTemplate> <DataTemplate> <TextBlock
I have a databound TextBlock control (which is being used inside a DataTemplate to
I have the following XAML: <TextBlock Text={Binding ElementName=EditListBox, Path=SelectedItems.Count} Margin=0,0,5,0/> <TextBlock Text=items selected> <TextBlock.Style>
I have a window in one assembly that has a TextBlock control that I
I have this control template that I am writing: <Style TargetType={x:Type controls:InfoBar}> <Setter Property=Template>
I have created a custom control for ImageButton as <Style TargetType={x:Type Button}> <Setter Property=Template>
I have TreeView control and I want to bind tree nodes' IsExpanded property to
I have a custom control with a TextBlock inside it: <Style TargetType={x:Type local:CustControl}> <Setter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.