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

Strange behavior in Blend

5 Answers 65 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 29 Sep 2010, 11:46 PM
I derived a class from RadRichTextBox and my XAML opens fine in Blend ... until I attempt to set the IsReadOnly or VerticalScrollbarVisibility attributes in my XAML:

<controls:BindableRadRichTextBox x:Name="richText" Toolbar="{Binding ElementName=border}" IsReadOnly="True" VerticalScrollBarVisibility="Disabled" Background="{x:Null}">
...

At this point Blend complains that "The local property 'IsReadOnly' can only be applied to types that are derived from RadRichTextBox." and the design surface crashes with an "invalid XAML" message.   Err ... what?

5 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 30 Sep 2010, 04:41 PM
Hi Michael,

I tried to reproduce your issue, but everything worked fine. I have attached a sample project created with the latest Blend 4, illustrating that.
There is a control which derives from RadRichTextBox and its IsReadOnly and VerticalScrollBarVisibility properties work just as expected.
Please check if you're not using an older version of Blend or if the issue is somehow related to your specific installation (e.g. try it on other computers).

Regards,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 30 Sep 2010, 05:34 PM
I ran into issues when I added a XamlDataProvider as a static resource in the control's XAML.  This makes things go very badly in Blend.  I'm using the latest Blend (v4.0.20525.0).  My Telerik controls are version 2010.2.0812.1040.  To be clear, I've essentially got this XAML:

<UserControl ...>
    <UserControl.Resources>
        <TelerikFormatProviders:XamlDataProvider ... RichTextBox={Binding ElementName=foo} ... />
    </UserControl.Resources>
    <Grid>
        ...
        <MyControls:RadRichTextBoxDerived x:Name="foo" IsReadOnly="True">
        ...
      </Grid>
</UserControl>

Blend warns about the IsReadOnly property.  It *runs* just fine, but if you view in the XAML in Blend it has a red squiggley under the IsReadOnly property.  Sometimes the art board will show a preview, sometimes it will say "Invalid XAML".  It's rather flakey.
0
Iva Toteva
Telerik team
answered on 04 Oct 2010, 01:35 PM
Hi Michael,

I ran the project with the same version of the controls and Blend 4 and nothing suspicious occurred. My code is:
<UserControl
    x:Class="DerivedFromRRTB.MainPage"
    Width="640" Height="480"
    xmlns:controls="clr-namespace:DerivedFromRRTB"
    xmlns:TelerikFormatProviders="clr-namespace:Telerik.Windows.Documents.FormatProviders.Xaml;assembly=Telerik.Windows.Documents.FormatProviders.Xaml">
      
    <UserControl.Resources>
        <TelerikFormatProviders:XamlDataProvider x:Key="xamlDataProvider" RichTextBox="{Binding ElementName=foo}" />
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <controls:BindableRadRichTextBox x:Name="foo" IsReadOnly="True" />
    </Grid
</UserControl>

You might try restarting Blend and setting the assembly references anew. Hopefully that solves the issue.

Regards,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 04 Oct 2010, 03:50 PM
Iva, I've tried your demo code and, as you said, it works fine in Blend.  However, my code clearly does not.  Some differences I can see in my code:

I'm using MVVM Light and binding events to commands using the EventToCommand trigger.
I've attached two custom behaviors in XAML to the class derived from RadRichTextBox.
I'm binding my XAMLDataProvider to a property on my DataContext.  The DC is bound to a static resource in the XAML which gives up either a design time or run time view model.  (ViewModelLocator pattern for MVVM)

I've tried commenting out all of these differences to get my code as similar to yours as possible, but I'm still seeing Blend report the error about IsReadOnly.  I've tried removing and readding the references to no avail.  I've also tried attaching Visual Studio to Blend, but I don't see any exceptions getting thrown.  (Just My Code is disabled; both Thrown and User Unhandled are enabled so I should see any exceptions.)

I'm at a loss as to how to get this control to behave properly.  I'm at the point where I'm about to write custom behaviors strictly to get the troublesome code out of the XAML so I can work with the remaining code in Blend.
0
Iva Toteva
Telerik team
answered on 05 Oct 2010, 01:53 PM
Hi Michael,

I am bound to think that the problem lies within Blend, since you do not get any exception in Visual Studio. Besides, I tried deleting and adding anew the references to the assemblies in Blend in my demo, prompting it to the right folder, but it just added references to another. That is when I got the same problem about the IsReadOnly property - with the references to the Q1 DLLs, so please make sure Blend is actually using the latest binaries.
There should not be a problem with using MVVM pattern to bind the RadRichTextBox.
If you would send me an application, illustrating your error, I might be able to assist you better.

Greetings,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
RichTextBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Michael
Top achievements
Rank 1
Share this question
or