What is the best way to customize bound text in WPF


Davita

As the title says, I need to customize part of the text in WPF, for example, I have a phrase "the fast brown fox jumps over the lazy dog" and I need to bold the word "brown", or change the background/foreground color of "fox". As far as I know, no regular WPF controls support this, are there any open source/free alternatives?

PS controls should be bindable

thanks.

Rohit Vats

You can Runuse to decorate text.

    <TextBlock>
        <Run>The quick </Run>
        <Run FontWeight="Bold" Background="Yellow">brown</Run>
        <Run Foreground="Red"> fox </Run>
        <Run>jumps over the lazy dog.</Run>
    </TextBlock>

output :

enter image description here

Also, if you're using WPF 4.0 and later, Microsoft has Textset the Run property to be a dependency property instead of a regular CLR property . So you can bind it too.

See bindable runs here .

Related


What is the best way to customize bound text in WPF

Davita As the title says, I need to customize part of the text in WPF, for example, I have a phrase "the fast brown fox jumps over the lazy dog" and I need to bold the word "brown", or change the background/foreground color of "fox". As far as I know, no regul

What is the best way to customize Bootstrap

username I'm having a lot of trouble with Bootstrap right now. I used it once to build a website and never used it again. But now, I have to use it. I downloaded the zipped version and included the JS and CSS files in the project. Here is the problem. I don't

What is the best way to customize Bootstrap

username I'm having a lot of trouble with Bootstrap right now. I used it once to build a website and never used it again. But now, I have to use it. I downloaded the zipped version and included the JS and CSS files in the project. Here is the problem. I don't

What is the best way to loop image rotation in WPF

mango I am looking for the best way to do this in wpf. I have asked this question and got an answer to implement it in opencv. What is the best way to rotate image rotation in opencv What is the best way to do this in wpf. Obviously I could create a writableBi

What is the best way to loop image rotation in WPF

mango I am looking for the best way to do this in wpf. I have asked this question and got an answer to implement it in opencv. What is the best way to rotate image rotation in opencv What is the best way to do this in wpf. Obviously I could create a writableBi

What is the best way to inject bound HTML in Polymer 2

Phil Giggs I need to display some bound HTML in my application. There was injectBoundHTML in Polymer < 0.8 and Polymer.Templatizer in 1, but what's the best way to do it in Polymer 2? Ofisola In Polymer 2, you can also use Polymer.Templatizer. Documentation ca

Angular.js: What is the best way to update bound data later

Lin Chen T If my initial data binds the ng-repeat directive, <!-- list 1--> <li ng-repeat="data in datas">{{data.name}}</li> Then change the data by another ng-repeat and ng-model directive, <!-- list 2--> <li ng-repeat="data in datas"> <input type="

What's the best way to customize a widget's JS script?

code copy I have a plugin that provides it's own widgets. I need to make slight changes to some events in the widget jsfile . Since I don't want to edit the file widget.jsdirectly , my understanding is that I need to unregister the script through my theme func

What is the best way to create a text input Redux

username I created a simple text field component using react-redux. This is a dumb component, so it receives a callback function to dispatch changes. So every time it changes, it changes its local state, and when it's "blurred" it calls a callback function. I

React - what is the best way to keep the text formatted

Charles Olivier Demers In a Word document, I have some text with indices. I'm wondering if it's possible to copy and paste text with exponents into ReactJS's text input and keep the text formatting. Thanks in advance! webdeb No, you can't just copy and paste s

What is the best way to align text above the input?

Jay Cummins I'm trying to generate a formula input with a value description above the input element. Here is what I am trying to reproduce: I sketched roughly how I want the formula element to work: https://jsfiddle.net/CumminsJP/rLt48z89 But I'm not taking in

What is the best way to subset such text by keywords?

Rollo99 I have a dataframe with N long texts. What I want to do is extract subsets of these texts based on some key phrases in the most efficient way possible. Let me give an example. dfis a dataframe with only one long text, like this: df = data.frame("Based

What is the best way to format the text in this Flutter example?

exemplary poet I have a card that can be tapped to turn DND on or off. Currently, on the card, I have a string of text that says "DND ON" or "DND OFF". What I'm trying to achieve is to add a smaller font and italics below "DND ON": "Alert, Media, Touch Sound".

React - what is the best way to keep the text formatted

Charles Olivier Demers In a Word document, I have some text with indices. I'm wondering if it's possible to copy and paste text with exponents into ReactJS's text input and keep the text formatting. Thanks in advance! webdeb No, you can't just copy and paste s

What is the best way to find text under headings

information learner I am working on an NLP project and I have input text in two formats. Format one: Some line Some line Name is <name> random text and numbers. age is <age> random text and numbers Some line Format 2: Some line Name <name>. Random text and n

What is the best way to create a text input Redux

username I created a simple text field component using react-redux. This is a dumb component, so it receives a callback function to dispatch changes. So every time it changes, it changes its local state, and when it's "blurred" it calls a callback function. I

What is the best way to create a text input Redux

username I created a simple text field component using react-redux. This is a dumb component, so it receives a callback function to dispatch changes. So every time it changes, it changes its local state, and when it's "blurred" it calls a callback function. I

What is the best way to create a text input Redux

username I created a simple text field component using react-redux. This is a dumb component, so it receives a callback function to dispatch changes. So every time it changes, it changes its local state, and when it's "blurred" it calls a callback function. I

What is the best way to find text under headings

information learner I am working on an NLP project and I have input text in two formats. Format one: Some line Some line Name is <name> random text and numbers. age is <age> random text and numbers Some line Format 2: Some line Name <name>. Random text and n

What is the best way to subset such text by keywords?

Rollo99 I have a dataframe with N long texts. What I want to do is extract subsets of these texts based on some key phrases in the most efficient way possible. Let me give an example. dfis a dataframe with only one long text, like this: df = data.frame("Based

What is the best way to subset such text by keywords?

Rollo99 I have a dataframe with N long texts. What I want to do is extract subsets of these texts based on some key phrases in the most efficient way possible. Let me give an example. dfis a dataframe with only one long text, like this: df = data.frame("Based

What is the best way to parse text messages

username I'm developing an application for parsing sms into strings to be stored in sqlite db. Here's an example of what a text message might look like. Sample call charges. Airtime payment made for UGX5,000 to KKL(0909xxxx). Your Balance is UGX10,000. Thank y

What is the best way to subset such text by keywords?

Rollo99 I have a dataframe with N long texts. What I want to do is extract subsets of these texts based on some key phrases in the most efficient way possible. Let me give an example. dfis a dataframe with only one long text, like this: df = data.frame("Based

What is the best way to create a text input Redux

username I created a simple text field component using react-redux. This is a dumb component, so it receives a callback function to dispatch changes. So every time it changes, it changes its local state, and when it's "blurred" it calls a callback function. I

What is the best way to create a text input Redux

username I created a simple text field component using react-redux. This is a dumb component, so it receives a callback function to dispatch changes. So every time it changes, it changes its local state, and when it's "blurred" it calls a callback function. I

React - what is the best way to keep the text formatted

Charles Olivier Demers In a Word document, I have some text with indices. I'm wondering if it's possible to copy and paste text with exponents into ReactJS's text input and keep the text formatting. Thanks in advance! webdeb No, you can't just copy and paste s

What is the best way to format the text in this Flutter example?

exemplary poet I have a card that can be tapped to turn DND on or off. Currently, on the card, I have a string of text that says "DND ON" or "DND OFF". What I'm trying to achieve is to add a smaller font and italics below "DND ON": "Alert, Media, Touch Sound".

What is the best way to subset such text by keywords?

Rollo99 I have a dataframe with N long texts. What I want to do is extract subsets of these texts based on some key phrases in the most efficient way possible. Let me give an example. dfis a dataframe with only one long text, like this: df = data.frame("Based

What is the best way to subset such text by keywords?

Rollo99 I have a dataframe with N long texts. What I want to do is extract subsets of these texts based on some key phrases in the most efficient way possible. Let me give an example. dfis a dataframe with only one long text, like this: df = data.frame("Based