This is a migrated thread and some comments may be shown as answers.

RadRichText LightSwitch Data-binding

5 Answers 163 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 27 Jul 2011, 12:03 AM
You guys did a tutorial on the RadRichText custom control for Lightswitch http://www.telerik.com/products/lightswitch-support.aspx
, I was wondering if you could expand on it and show us how to Data-bind a RadRichTextBox with a Xaml Data Provider and use in a LightSwitch app and bind it to a table built in Lightswitch. I have been working on this for many hours and no luck. Thanks for your help...Brian

5 Answers, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 01 Aug 2011, 03:04 PM
Hi Brian,

In order to get the data binding working in LightSwitch, you have to follow these steps:
  1. Create the appropriate fields and queries in your LightSwitch project, just as you would if you weren't using a custom control.
  2. Open RichTextControl.xaml as in the demo and add this right above the RadRichTextBox instance:
  3. <telerikXaml:XamlDataProvider RichTextBox="{Binding ElementName=radRichTextBox1}" Xaml="{Binding Screen.MyXamlProperty}" />
    You have to change the Xaml binding to be bound to whatever you want to view in your RichTextControl.
We've tried this approach with a string property and it worked perfectly. You should be able to use it with a database query without a problem.

Greetings,
Ivailo
the Telerik team

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

0
Brian
Top achievements
Rank 1
answered on 01 Aug 2011, 04:54 PM
Ivailo, I tried to enter the code you suggested:

<telerikXaml:XamlDataProviderRichTextBox="{Binding ElementName=radRichTextBox1}"
			Xaml="{Binding Screen.MyXamlProperty}" />

I get an error:
Error	5 The type 'telerikXaml:XamlDataProviderRichTextBox' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

I tried entering a RadRichTextBox with the Wizard and selected Text Box or Rich Text Box option
on the first screen and this is the code it came up with:

			<telerik:RadRichTextBox.Resources>
				<my:XamlDataProvider
					x:Key="provider"
					RichTextBox="{Binding ElementName=radRichTextBox1}" />
			</telerik:RadRichTextBox.Resources>


Any suggestions on how to get you code working in the example you guys created...Thanks 

0
Ivailo Karamanolev
Telerik team
answered on 04 Aug 2011, 01:09 PM
Hi Brian,

There is a small mistake in your XAML code. Actually, there is a space between XamlDataProvider and RichTextBox, as I have posted the code and if you change that, it should compile OK.

Regards,
Ivailo
the Telerik team

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

0
Paul
Top achievements
Rank 1
answered on 29 Aug 2011, 04:29 PM
Hi Brian,

Here is a link to an article where I show how to bind the RadRichTextBox control to a table...

http://www.paulspatterson.com/technology/dot-net-development/microsoft-lightswitch-telerik-radrichtextbox-document-database/

Enjoy,

Paul
PaulSPatterson.com
0
Iva Toteva
Telerik team
answered on 30 Aug 2011, 09:37 AM
Hello Paul,

Your blog post is really appealing! Thank you for the community effort. I am sure that people can greatly benefit from the walk through you have made about the use of RadRichTextBox in LightSwitch.

Kind regards,
Iva
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
RichTextBox
Asked by
Brian
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Brian
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or