I need to put data from two different datasourses in the same textbox. The text that comes from the first one have to be bolded and the secound normal.
It’s there a possibility to do this in WPF?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You cannot bind (or multibind) to
Documentproperty ofRichTextBox, because it is NOT aDependencyProperty(strange!!!)!!! See this link for a really easy way of subclassingRichTextBoxto create your ownBindableRichTextBoxor this post for another workaround.Now you can use
MultiBindingwith a customIMultiValueConverterto achieve the results. Since you have not given much details of your problem, I can only give you an overall idea of what you should do:And now you can do like this:
And then create a class
MySourceBToBoldConverterthat inherits fromIMultiValueConverterlike this:Currently I don’t have my work PC with me that has VS installed, so I can’t give you a working example, but go ahead and search google/msdn/stackoverflow 4MultiBindingandIMultiValueConverterand you’ll find some good examples out there.Check the working example here.
Regards,
Mihir Gokani