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

RichTextBox in a RadTreeListView

1 Answer 30 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Prabhu
Top achievements
Rank 1
Prabhu asked on 19 Jan 2012, 12:16 PM
Hi,

I'm trying to use a RichTextBox in a RadTreeListView. Below is the xaml

<telerik:RadTreeListView Grid.Row="1"
                                 HorizontalAlignment="Stretch"
                                 VerticalAlignment="Stretch"
                                 x:Name="RTLView"
                                 AutoGenerateColumns="False"
                                 IsSynchronizedWithCurrentItem="True"
                                 IsReadOnly="True"
                                 ItemsSource="{Binding Items}"
                                 ItemContainerStyle="{StaticResource ItemContainerStyle}"
                                 IsFilteringAllowed="False">
            <telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:TreeListViewTableDefinition ItemsSource="{Binding Children}" />
            </telerik:RadTreeListView.ChildTableDefinitions>
            <telerik:RadTreeListView.Columns>
                <telerik:GridViewDataColumn Width="350">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <RichTextBox x:Name="ItemName"
                                         ux:RichTextBoxHelper.DocumentMarkup="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
                                         Margin="{Binding Margin}"
                                         Padding="0,5,0,0"
                                         VerticalScrollBarVisibility="Auto"
                                         Cursor="Arrow"
                                         Focusable="False"
                                         MaxHeight="80" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
       </telerik:RadTreeListView.Columns>
 </telerik:RadTreeListView>


When i run the application, the content renders properly the first time but when i select any row, I'm getting the following exception.

System.InvalidCastException was unhandled by user code
  Message=Unable to cast object of type 'System.Windows.Documents.Paragraph' to type 'System.Windows.UIElement'.
  Source=Telerik.Windows.Controls.GridView
  StackTrace:
       at Telerik.Windows.Controls.SelectableTextBoxDragHandler.OnMouseLeftButtonDown(Object sender, MouseButtonEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\TreeListView\SelectableTextBoxDragHandler.cs:line 28
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Window.ShowDialog()
  InnerException:


Earlier i used the same RichTextBox in a ListView, it worked fine. After changing to RadTreeListView I'm facing issues.

Please help!

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 19 Jan 2012, 01:03 PM
Hi,

 This is already fixed! Please upgrade to our latest official version (Q3 2011 Sp1).

All the best,
Vlad
the Telerik team

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

Tags
TreeListView
Asked by
Prabhu
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or