Binding HTML content to a "RichHTMLTextBlock" in XAML - wpf

I am having a WPF application, in which i am using RichTextBox and binding it to a field in the database which contains the data as a HTML text. Also i applied TextFormatter="{StaticResource HtmlFormatter}" for the RichTextBox. Now if in the field i have a paragraph with some html styles applies like font color, font size etc they are supposed to appear in the same style.But i am not able to see the font size in the application, though font style and font color are applied.
Can anybody help on this ?
Thanks in advance!!!

Related

Define the defaults values of winform controls

I have an app(new app) to developpe, changing all values like Font style and TextBox height and other properties of all controls in application is so hard, can i fixing this in the for example app.conf! and how do i express that ?
For example:
i want to use Font Segio, 11 for all Label controls
RowHeight by default use 35 for all Grids-View in my application
You can set the font of the form(or their parent control) and all of its child controls will inherit the font of its parent.
Also you can read the font from config file and set that in you form.
Google "Reading from config file c#" if you don't know that yet.

Decorating text (Bold/Italic) of Label programmatically in Codename One

I want to decorate Label text as Bold or Italic or both.
So far to make it work, I'm applying label.setUIID("BoldItalic_Label") or setting different UIID in same manner.
But now I want to decorate Label Text programmatically. I've tried mostly all style properties which can be applied to label text, it doesn't work for me.
Can anybody suggest the workaround ?
Try label.getUnselectedStyle().setFont(font).
You can create the font object using the Font class's factory methods.

Labeled text box

i am trying to write a control template where i want a label for text box on top of the textbox. So i invite your suggestions for how to achieve this.
so far i did that using a stack pannel with vertical orientation and then added textblock and text box. Like wise i created 45 stackpannels. So i dont want to go like that. instaed i want to write a control template where i can have label and text box and then set label value and text box value.
my:CustomControl labelText="First Name:" TextBoxText="john Doe" />
any ideas are greatly appreciated.
Thanks.
You can make a UserControl with DependencyProperties for Text and Label, put your StackPanel in it, and bind the label and textbox to the dependency properties.
Make sure the Text property has FrameworkPropertyMetadata.BindsTwoWayByDefault
Have a look at the Silverlight Toolkit
It includes both HeaderedContentControl and DataField controls. The DataField is mainly for use with DataForm, but as far as I know, you can use it any way you like. The HeaderedContentControl I haven't tried myself, but it could be just what you are looking for.

AutoCompleteBox Dropdown width

Can the width of the dropdown be set to a different value than the AutoCompleteBox itself?
The Popup is a separate Part of the AutoCompleteBox, so it should be possible to extend that beyond the width of the text box.
In Blend, right-click on the AutoCompleteBox and select Edit Template > Edit a Copy, giving the new template a name.
Drill-down in the Objects and Timeline window to the 'Popup' part, and beneath that is a Grid. Change the width of that Grid to change the width of the popup content whilst maintaining the current width of the text box).
(I must admit I've only had chance to do this in Silverlight Spy, but it definitely works there so I can't see it being a problem doing it through Blend).
If you are not using Blend, just copy Default Style and Template of AutocompleteBox from MSDN and paste it into your App.xaml file (here is little tutorial on how to handle styles in app.xaml).
You can then modify that pasted style or template.

Silverlight: How to style the validation tooltip?

I did some searching but it wasn't what I was looking for. So, does anyone know a way how to style the validation tooltip in Silverlight(the thing in the green border)?
alt text http://img689.imageshack.us/img689/222/validationtooltip.png
Any help would be greatly appreciated!
Best Regards,
~K
Unfortunately you can't easily provide a style for the validation tooltip without effectively styling the entire Textbox control. Blend makes this fairly easy if you are familiar with using that design tool. However if your a dyed in the wool coder like me then...
Goto this page on MSDN TextBox Styles and Templates
Copy the vsm namespace alias to your UserControl xaml
Copy the TextBox style into UserControls.Resources give it at an x:Key name (say MyTextBoxStyle")
Copy the ValidationToolTipTemplate from the web page to the UserControls.Resources, paste it above the TextBox style. It already has an x:Key name that the TextBox style will be referencing.
Add Style="{StaticResource MyTextBoxStyle}" to your TextBox in the data grid.
Now you play around with the validation elements of the templates to get your desired result.
The validation messages are displayed as a visual state. you can get to these (and edit them) as templates directly from blend.

Resources