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

SelectionChanged event firing when clicking anything in tab

4 Answers 200 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Jerry T.
Top achievements
Rank 1
Jerry T. asked on 21 Apr 2011, 10:04 PM
I have a RadTabControl with 3 tabs.

When I click on the 2nd tab, I'm loading a RadPanelBar with multiple RadPanelBarItems, each one containing a RadRichTextBox control.

Whenever I click on ANYthing on that tab (the RadPanelBarItems...the RadRichTextBox controls...etc.) the RadTabControl's SelectionChanged event (and PreviewSelectionChanged event, too) fires.  This is killing me as I dynamically add some RadPanelBarItems based on content from the 1st tab.

Why is the SelectionChanged event firing when I'm not even clicking on the RadTabControl?

Jerry

4 Answers, 1 is accepted

Sort by
0
Jerry T.
Top achievements
Rank 1
answered on 25 Apr 2011, 01:59 PM
Still wondering....
0
Petar Mladenov
Telerik team
answered on 27 Apr 2011, 10:28 AM
Hi Jerry T.,

We are unable to reproduce this at our side. Could you please examine my test project to see if I have missed something or to modify it in order to reproduce the issue? Thank you for your cooperation.

All the best,
Petar Mladenov
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
Jerry T.
Top achievements
Rank 1
answered on 28 Apr 2011, 03:01 PM
That test project works ok and I notice you're using the SelectionChanged event with the RoutedEventArgs parameter.

I once saw that parameter type show up in our code but there are TWO SelectionChanged events that show up in the dropdown in Vis Studio and selecting either one brings up an event with SelectionChangedEventArgs (as does the PreviewSelectionChangedEvent). If I select either SelectionChangedEvent from the dropdown, the first is bolded. If I then try to select the 2nd, I get a duplicate event and the 2nd event name in the dropdown does not show bolded.

Here is the markup XAML:
<UserControl x:Class="BTA.Silverlight.MainPage"
    xmlns:local="clr-namespace:BTA.Silverlight"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
  
    <Border Padding="20">
        <Grid x:Name="LayoutRoot">
            <Grid.Effect>
                <DropShadowEffect Color="Gray" Direction="0" ShadowDepth="0" BlurRadius="20" Opacity="1" />
            </Grid.Effect>
  
            <telerik:RadTabControl x:Name="rtcProposal" Grid.Row="0" HorizontalAlignment="Stretch" DropDownDisplayMode="Visible">
              
                <telerik:RadTabItem x:Name="rtiCostingSheet" Header="Costing Sheet" Width="100" Height="30">
                    <telerik:RadTabItem.Content>
  
                        <telerik:RadBusyIndicator x:Name="rbiCostingSheet" BusyContent="Loading costing sheet data...">
                            <telerik:RadGridView x:Name="rgCostingSheet" CanUserFreezeColumns="False" AutoGenerateColumns="False" IsFilteringAllowed="False">
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding VendorName}" Header="Vendor" Width="150" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding CostingItem}" Header="Costing Item" Width="200" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding UnitCost}" DataFormatString="{}{0:C}" Header="Unit Cost" Width="95" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Units}" Header="Units" Width="45" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Hours}" Header="Hours" Width="45" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Gratuity}" DataFormatString="{}{0:C}" Header="Gratuity" Width="95" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Tax}" DataFormatString="{}{0:0%}" Header="Tax" Width="95" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Taxable}" Header="Tax?" Width="45" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Cost}" DataFormatString="{}{0:C}" Header="Cost" Width="95" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding GrossProfitPercent}" DataFormatString="{}{0:0%}" Header="GP%" Width="45" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding UnitRevenue}" DataFormatString="{}{0:C}" Header="Unit Rev" Width="95" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding PricingOptions}" Header="Pricing" Width="100" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Revenue}" DataFormatString="{}{0:C}" Header="Revenue" Width="95" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding RevenuePerPerson}" DataFormatString="{}{0:C}" Header="Rev PP" Width="95" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Commission}" Header="Comm" Width="100" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding BillType}" Header="Bill Type" Width="75" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Group}" Header="Group" Width="45" HeaderTextAlignment="Right" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Sort}" Header="Sort" Width="45" HeaderTextAlignment="Right" TextAlignment="Right" />
                                </telerik:RadGridView.Columns>
                            </telerik:RadGridView>
                        </telerik:RadBusyIndicator>
                          
                    </telerik:RadTabItem.Content>
                </telerik:RadTabItem>
  
                <telerik:RadTabItem x:Name="rtiWriteUp" Header="Write-Up" Width="100" Height="30">
                    <telerik:RadTabItem.Content>
  
                        <telerik:RadBusyIndicator x:Name="rbiWriteUp" IsIndeterminate="False" BusyContent="Importing... 0% Complete">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="150" />
                                </Grid.ColumnDefinitions>
  
                                    <telerik:RadPanelBar x:Name="rpbWriteUpSections" Grid.Column="0" Margin="5" ExpandMode="Multiple" IsDragDropEnabled="True" TextDropAfter="Move item after..." TextDropBefore="Move item before..." TextDropRoot="WriteUp - " IsDragPreviewEnabled="True" IsDropPreviewLineEnabled="True" />
                              
                                    <StackPanel Grid.Column="1" HorizontalAlignment="Stretch">
                                        <telerik:RadButton x:Name="rbImportCostingSheet" Width="130" Content="Import Costing Sheet" Margin="0 5 0 5" Visibility="Collapsed" />
                                        <telerik:RadSplitButton x:Name="rsbAddSection" Width="130" Content="Add Section" Margin="0 5 0 5">
                                            <telerik:RadSplitButton.DropDownContent>
                                                <ListBox SelectionChanged="rsbAddSection_ListBox_SelectionChanged">
                                                    <ListBoxItem Content="New Empty Section" />
                                                    <ListBoxItem Content="New Section From File" />
                                                    <ListBoxItem Content="New Section From Library" />
                                                </ListBox>
                                        </telerik:RadSplitButton.DropDownContent>
                                    </telerik:RadSplitButton>
                                    <telerik:RadButton x:Name="rbRemoveSection" Width="130" Content="Remove Section" />
  
                                </StackPanel>
                            </Grid>
                                  
                        </telerik:RadBusyIndicator>
                      
                    </telerik:RadTabItem.Content>
                </telerik:RadTabItem>
  
                <telerik:RadTabItem x:Name="rtiPreview" Header="Preview" Width="100" Height="30">
                    <telerik:RadTabItem.Content>
  
                        <telerik:RadBusyIndicator x:Name="rbiPreview" BusyContent="Generating Preview...">
                            <Grid x:Name="RichTextBoxContainer">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.Resources>
                                    <LinearGradientBrush x:Key="DottedLineBrush" StartPoint="0,0.5" EndPoint="4,0.5" MappingMode="Absolute" SpreadMethod="Repeat">
                                        <GradientStop Color="#40000000" Offset="0" />
                                        <GradientStop Color="#40000000" Offset="0.5" />
                                        <GradientStop Color="Transparent" Offset="0.501" />
                                    </LinearGradientBrush>
                                </Grid.Resources>
  
                                <telerik:RadRichTextBoxRibbonUI Grid.Row="0" ApplicationName="" ApplicationButtonContent="File" ApplicationButtonType="Office2010" IsMinimized="True" DataContext="{Binding Path=Commands, ElementName=rrtbPreview}" BackstageClippingElement="{Binding ElementName=RichTextBoxContainer}">
                                    <telerik:RadRibbonBar.Backstage>
                                        <telerik:RadRibbonBackstage>
                                            <telerik:RadRibbonBackstageItem Header="Save As" Icon="/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/save.png" IsSelectable="False" Command="{Binding Path=SaveCommand}" />
                                            <telerik:RadRibbonBackstageItem IsGroupSeparator="True" />
                                            <telerik:RadRibbonBackstageItem Header="Print" Icon="../Images/16/Print.png">
                                                <StackPanel Margin="15 15 0 0">
                                                    <TextBlock Margin="0 0 0 2" FontSize="12" FontWeight="Bold" Text="Preview and print the document" />
                                                    <Rectangle Height="1" Fill="{StaticResource DottedLineBrush}" />
                                                    <telerik:RadRibbonButton Width="460" Margin="0 3 0 0" CommandParameter="Html" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=PrintCommand}">
                                                        <StackPanel Orientation="Horizontal">
                                                            <Image Source="/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/ApplicationMenu/print.png" />
                                                            <StackPanel Margin="3 0 0 0" HorizontalAlignment="Left">
                                                                <TextBlock Text="Print HTML" Margin="0 0 0 2" FontWeight="Bold" />
                                                                <TextBlock Text="Select a printer, number of copies before printing." />
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </telerik:RadRibbonButton>
                                                    <telerik:RadRibbonButton Width="460" Margin="0 3 0 0" CommandParameter="Native" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=PrintCommand}">
                                                        <StackPanel Orientation="Horizontal">
                                                            <Image Source="/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/ApplicationMenu/pagesetup.png" />
                                                            <StackPanel>
                                                                <TextBlock FontWeight="Bold" Margin="0 0 0 2" Text="Native Print" />
                                                                <TextBlock Text="Send the document directly to the default printer without making changes." />
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </telerik:RadRibbonButton>
                                                    <telerik:RadRibbonButton Width="460" Margin="0 3 0 0" CommandParameter="HtmlPreview" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=PrintCommand}">
                                                        <StackPanel Orientation="Horizontal">
                                                            <Image Source="/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/ApplicationMenu/print_preview.png" />
                                                            <StackPanel>
                                                                <TextBlock FontWeight="Bold" Margin="0 0 0 2" Text="Print Preview" />
                                                                <TextBlock Text="Preview and make changes to pages before printing." />
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </telerik:RadRibbonButton>
                                                </StackPanel>
                                            </telerik:RadRibbonBackstageItem>
                                            <telerik:RadRibbonBackstageItem Header="Send" Icon="../Images/16/Email.png" IsDefault="True">
                                                <StackPanel Margin="15 15 0 0">
                                                    <TextBlock Margin="0 0 0 2" FontSize="12" FontWeight="Bold" Text="Send a copy of the document to other people" />
                                                    <Rectangle Height="1" Fill="{StaticResource DottedLineBrush}" />
                                                    <telerik:RadRibbonButton Width="460" Margin="0 3 0 0">
                                                        <StackPanel Orientation="Horizontal">
                                                            <Image Source="../Images/32/EmailWord.png" />
                                                            <StackPanel Margin="3 0 0 0" HorizontalAlignment="Left">
                                                                <TextBlock Text="E-mail as Word Attachment" Margin="0 0 0 2" FontWeight="Bold" />
                                                                <TextBlock Text="Send a copy of the document in an e-mail message as a Word attachment." />
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </telerik:RadRibbonButton>
                                                    <telerik:RadRibbonButton Width="460" Margin="0 3 0 0">
                                                        <StackPanel Orientation="Horizontal">
                                                            <Image Source="../Images/32/EmailPdf.png" />
                                                            <StackPanel Margin="3 0 0 0" HorizontalAlignment="Left">
                                                                <TextBlock Text="E-mail as PDF Attachment" Margin="0 0 0 2" FontWeight="Bold" />
                                                                <TextBlock Text="Send a copy of the document in an e-mail message as a PDF attachment." />
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </telerik:RadRibbonButton>
                                                    <telerik:RadRibbonButton Width="460" Margin="0 3 0 0">
                                                        <StackPanel Orientation="Horizontal">
                                                            <Image Source="../Images/32/EmailLink.png" />
                                                            <StackPanel Margin="3 0 0 0" HorizontalAlignment="Left">
                                                                <TextBlock Text="E-mail Link" Margin="0 0 0 2" FontWeight="Bold" />
                                                                <TextBlock Text="Send a link to the document in an e-mail message." />
                                                            </StackPanel>
                                                        </StackPanel>
                                                    </telerik:RadRibbonButton>
                                                </StackPanel>
                                            </telerik:RadRibbonBackstageItem>
                                            <telerik:RadRibbonBackstageItem IsGroupSeparator="True" />
                                            <telerik:RadRibbonBackstageItem Header="Finalize" Icon="../Images/16/Check.png" IsSelectable="False" />
                                        </telerik:RadRibbonBackstage>
                                    </telerik:RadRibbonBar.Backstage>
                                </telerik:RadRichTextBoxRibbonUI>
  
                                <telerik:RadRichTextBox Grid.Row="1" Name="rrtbPreview" IsReadOnly="True" IsSelectionEnabled="True" />
                            </Grid>
                                  
                        </telerik:RadBusyIndicator>
  
                    </telerik:RadTabItem.Content>
                </telerik:RadTabItem>
  
            </telerik:RadTabControl>
          
        </Grid>
    </Border>
      
</UserControl>


Here is the code-behind:
Imports Telerik.Windows.Documents
Imports Telerik.Windows.Documents.Layout
Imports Telerik.Windows.Documents.Model
Imports Telerik.Windows.Documents.FormatProviders
Imports Telerik.Windows.Documents.FormatProviders.Xaml
Imports System.IO
Imports System.ComponentModel
  
Partial Public Class MainPage
    Inherits UserControl
  
    Private WorkerImportCostingSheetSections As New BackgroundWorker()
    Private WorkerPreview As New BackgroundWorker()
  
    Public Sub New()
        Telerik.Windows.Controls.StyleManager.ApplicationTheme = New Telerik.Windows.Controls.Office_SilverTheme
  
        InitializeComponent()
  
        Me.GetCostingSheetData()
  
        AddHandler WorkerImportCostingSheetSections.DoWork, AddressOf Me.DoWorkImportCostingSheetSections
        AddHandler WorkerImportCostingSheetSections.RunWorkerCompleted, AddressOf Me.RunWorkerCompletedCompletedImportCostingSheetSections
  
        AddHandler WorkerPreview.DoWork, AddressOf Me.DoWorkPreview
        AddHandler WorkerPreview.RunWorkerCompleted, AddressOf Me.RunWorkerCompletedPreview
  
    End Sub
  
    Private Sub GetCostingSheetData()
        Dim client = New Services.BTAServiceClient()
  
        AddHandler client.GetCostingSheetsCompleted, Sub(s As Object, e As Services.GetCostingSheetsCompletedEventArgs)
                                                         System.Threading.Thread.Sleep(1000) ' add pause so busy indicator doesn't disappear to fast
                                                         Me.rgCostingSheet.ItemsSource = e.Result
                                                         Me.rbiCostingSheet.IsBusy = False
                                                     End Sub
  
        Me.rbiCostingSheet.IsBusy = True
        client.GetCostingSheetsAsync()
    End Sub
  
    Private Sub rtcProposal_PreviewSelectionChanged(sender As Object, e As Telerik.Windows.Controls.SelectionChangedEventArgs) Handles rtcProposal.PreviewSelectionChanged
  
        Select Case rtcProposal.SelectedIndex
            Case 1
                If (Not WorkerImportCostingSheetSections.IsBusy) AndAlso (rbImportCostingSheet.IsEnabled) Then
                    rbImportCostingSheet.IsEnabled = False
                    Me.rbiWriteUp.ProgressValue = 0
                    Me.rbiWriteUp.IsBusy = True
                    WorkerImportCostingSheetSections.RunWorkerAsync()
                End If
            Case 2
                If Not WorkerPreview.IsBusy Then
                    Me.rbiPreview.ProgressValue = 0
                    Me.rbiPreview.IsBusy = True
                    WorkerPreview.RunWorkerAsync()
                End If
        End Select
  
    End Sub
  
    Private Function MergeDocuments(ByVal doc1 As RadDocument, ByVal doc2 As RadDocument, ByVal insertPageBreak As Boolean) As RadDocument
        doc1.Selection.SelectAll()
        doc2.Selection.SelectAll()
  
        Dim mergedDocument As New RadDocument()
  
        ' This is required only if the document is not visualized yet;
        ' so if you, for example, are using the document from your preview RadRichTextBox this is not needed
        Me.MeasureAndArrangeInDefaultSize(mergedDocument)
  
        mergedDocument.InsertFragment(doc1.Selection.CopySelectedDocumentElements())
  
        Dim position As New DocumentPosition(mergedDocument)
  
        position.MoveToLastPositionInDocument()
  
        mergedDocument.InsertLineBreak()
        mergedDocument.InsertLineBreak()
  
        mergedDocument.InsertFragment(doc2.Selection.CopySelectedDocumentElements())
  
        MergeDocuments = mergedDocument
  
        doc1.Selection.Clear()
        doc2.Selection.Clear()
    End Function
  
    Private Sub MeasureAndArrangeInDefaultSize(document As RadDocument)
        document.Measure(RadDocument.MAX_DOCUMENT_SIZE)
        document.Arrange(New RectangleF(PointF.Empty, document.DesiredSize))
    End Sub
  
    'Private Function ImportRadDocument(content As String) As RadDocument
    '    Dim provider As New Html.HtmlFormatProvider    'FormatProviders.Xaml.XamlFormatProvider
    '    Dim document As RadDocument
  
    '    Using stream As New MemoryStream()
    '        Dim writer As New StreamWriter(stream)
  
    '        writer.Write(content)
    '        writer.Flush()
    '        stream.Seek(0, SeekOrigin.Begin)
  
    '        document = provider.Import(stream)
    '    End Using
  
    '    Return document
  
    'End Function
  
    Private Sub rsbAddSection_ListBox_SelectionChanged(sender As Object, e As System.Windows.Controls.SelectionChangedEventArgs)
  
        If DirectCast(sender, System.Windows.Controls.ListBox).SelectedIndex <> -1 Then
  
            Me.rsbAddSection.IsOpen = False
  
            Dim Document As RadDocument = Nothing
  
            With DirectCast(sender, System.Windows.Controls.ListBox)
                Select Case .SelectedIndex
                    Case 0
  
                    Case 1
                        Dim dialog As New OpenFileDialog() With {.Multiselect = False}
  
                        If dialog.ShowDialog() AndAlso dialog.File IsNot Nothing Then
                            Using s As FileStream = dialog.File.OpenRead()
                                Document = New OpenXml.Docx.DocxFormatProvider().Import(s)
                            End Using
                        Else
                            Exit Sub
                        End If
  
                    Case 2
  
                End Select
            End With
  
            RadWindow.Prompt(
                New DialogParameters() With {
                    .Content = "Enter section title",
                    .Closed = New EventHandler(Of WindowClosedEventArgs)(
                        Sub(sender1 As Object, e1 As WindowClosedEventArgs)
                            If e1.DialogResult Then
                                Dim pbi As New BTA.Silverlight.PanelBarItem() With {.AllowDrop = True}
                                pbi.HeaderText.Text = e1.PromptResult
  
                                If Me.rpbWriteUpSections.Items.Count = 0 Then pbi.Margin = New Thickness(0)
  
                                With DirectCast(sender, System.Windows.Controls.ListBox)
                                    Select Case .SelectedIndex
                                        Case 0
  
                                        Case 1
                                            pbi.RichTextBox.Editor.Document = Document
                                        Case 2
  
                                    End Select
  
                                    rpbWriteUpSections.Items.Add(pbi)
  
                                    .SelectedIndex = -1
                                End With
                            End If
                        End Sub
                    )
                }
            )
  
        End If
  
    End Sub
  
    Private Sub rpbWriteUpSections_PreviewDragEnded(sender As Object, e As Telerik.Windows.Controls.RadTreeViewDragEndedEventArgs) Handles rpbWriteUpSections.PreviewDragEnded
        If (e.DropPosition = DropPosition.Inside) Then e.Handled = True
    End Sub
  
    Private Sub DoWorkImportCostingSheetSections(sender As Object, e As DoWorkEventArgs)
  
        Dim ProgressValueIncrement As Double = 100 / Me.rgCostingSheet.Items.Count
  
        Dim Document As RadDocument = Nothing
        Dim vendor As String = String.Empty
        Dim pricingInfo As String = String.Empty
        Dim finalText As String = String.Empty
  
        For Each item In Me.rgCostingSheet.Items.OfType(Of BTA.Silverlight.Services.CostingSheet)()
  
            Me.Dispatcher.BeginInvoke(
                Sub()
                    If Document Is Nothing Then Document = New RadDocument()
  
                    Me.rbiWriteUp.ProgressValue += ProgressValueIncrement
                    Me.rbiWriteUp.BusyContent = "Importing... " & Me.rbiWriteUp.ProgressValue & "% Complete"
  
                    If (vendor <> String.Empty) AndAlso (vendor <> item.VendorName) Then
                        With Document
                            .Measure(RadDocument.MAX_DOCUMENT_SIZE)
                            .ParagraphDefaultSpacingAfter = 0
  
                            finalText += "<t:TableRow>" + vbCrLf +
                                         "<t:TableCell TextAlignment=""left""><t:Paragraph><t:Span FontFamily=""14"" FontSize=""14"" FontWeight=""Bold"" HighlightColor=""LightGray"" Text=""" + vendor + """></t:Span></t:Paragraph></t:TableCell>" + vbCrLf +
                                         "</t:TableRow>" + vbCrLf +
                                         pricingInfo + vbCrLf +
                                         "<t:TableRow>" + vbCrLf +
                                         "<t:TableCell TextAlignment=""left""><t:Paragraph><t:Span Text="" ""></t:Span></t:Paragraph></t:TableCell>" + vbCrLf +
                                         "</t:TableRow>" + vbCrLf
                            pricingInfo = String.Empty
                        End With
                    End If
  
                    vendor = item.VendorName
                    pricingInfo += "<t:TableRow>" + vbCrLf +
                                   "<t:TableCell TextAlignment=""left""><t:Paragraph><t:Span Text=""" + item.CostingItem + """></t:Span></t:Paragraph></t:TableCell>" + vbCrLf +
                                   "<t:TableCell TextAlignment=""right""><t:Paragraph><t:Span FontFamily=""Arial"" FontSize=""12"" Text=""" + String.Format("{0:C}", item.Cost) + """></t:Span></t:Paragraph></t:TableCell>" + vbCrLf +
                                   "</t:TableRow>" + vbCrLf
                End Sub)
  
            System.Threading.Thread.Sleep(250)
        Next
  
        Me.Dispatcher.BeginInvoke(
            Sub()
                finalText += "<t:TableRow>" + vbCrLf +
                             "<t:TableCell TextAlignment=""left""><t:Paragraph><t:Span FontFamily=""14"" FontSize=""14"" FontWeight=""Bold"" HighlightColor=""LightGray"" Text=""" + vendor + """></t:Span></t:Paragraph></t:TableCell>" + vbCrLf +
                             "</t:TableRow>" + vbCrLf +
                             pricingInfo
  
                Me.rpbWriteUpSections.Items.Clear()
  
                Dim pbi As New BTA.Silverlight.PanelBarItem() With {.IsExpanded = False}
                pbi.HeaderText.Text = "Overview"
                Me.rpbWriteUpSections.Items.Add(pbi)
  
                pbi = New BTA.Silverlight.PanelBarItem() With {.IsExpanded = False}
                pbi.HeaderText.Text = "Itinerary 1"
                Me.rpbWriteUpSections.Items.Add(pbi)
  
                pbi = New BTA.Silverlight.PanelBarItem() With {.IsExpanded = False}
                pbi.HeaderText.Text = "Detail"
                Me.rpbWriteUpSections.Items.Add(pbi)
  
                Dim pbiPricing = New BTA.Silverlight.PanelBarItem() With {.IsExpanded = True}
                pbiPricing.HeaderText.Text = "Pricing Info"
                finalText = "<t:RadDocument xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:t=""clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents"" DefaultPageLayoutSettings=""793,1123"" LayoutMode=""Paged"" PageViewMargin=""10,10"" ParagraphDefaultSpacingAfter=""0"" SectionDefaultPageMargin=""95,95,95,95"">" + vbCrLf +
                            "<t:Section><t:Table Borders=""1,Single,#FFFFFFFF"">" + vbCrLf +
                            finalText +
                            "</t:Table></t:Section></t:RadDocument>"
  
                pbiPricing.RichTextBox.Editor.Document = New XamlFormatProvider().Import(finalText)
                Me.rpbWriteUpSections.Items.Add(pbiPricing)
            End Sub)
  
    End Sub
  
    Private Sub RunWorkerCompletedCompletedImportCostingSheetSections(sender As Object, e As RunWorkerCompletedEventArgs)
        Me.Dispatcher.BeginInvoke(Sub() Me.rbiWriteUp.IsBusy = False)
    End Sub
  
    Private Sub DoWorkPreview(sender As Object, e As DoWorkEventArgs)
  
        Me.Dispatcher.BeginInvoke(
            Sub()
                Dim newDoc As New RadDocument()
  
                For Each pbi As PanelBarItem In Me.rpbWriteUpSections.Items
                    newDoc = MergeDocuments(newDoc, pbi.RichTextBox.Editor.Document, (pbi.Index > 0))
                Next
  
                Me.rrtbPreview.LayoutMode = DocumentLayoutMode.Paged
                Me.rrtbPreview.Document = newDoc
                Me.rrtbPreview.IsSpellCheckingEnabled = False
            End Sub)
  
        System.Threading.Thread.Sleep(1000)
  
    End Sub
  
    Private Sub RunWorkerCompletedPreview(sender As Object, e As RunWorkerCompletedEventArgs)
        Me.Dispatcher.BeginInvoke(Sub() Me.rbiPreview.IsBusy = False)
    End Sub
  
    Private Sub rtcProposal_SelectionChanged(sender As Object, e As Telerik.Windows.Controls.SelectionChangedEventArgs) Handles rtcProposal.SelectionChanged
  
    End Sub
  
    Private Sub rtcProposal_SelectionChanged1(sender As Object, e As Telerik.Windows.Controls.SelectionChangedEventArgs) Handles rtcProposal.SelectionChanged
  
    End Sub
End Class
0
Tina Stancheva
Telerik team
answered on 03 May 2011, 07:11 PM
Hi Jerry T.,

Unfortunately I couldn't reproduce your issue from the code snippet you sent and this is why I wanted to ask you to please open a support ticket and send us a small working sample application reproducing your issue so that we can further investigate the cause for it. Also, can you please tell us the version of the controls you are using in your application? There were some issues with the SelectionChanged events in the official release that are fixed in the Q1 2011 SP1 release so it might be related to them.

We appreciate your help and further information. Thank you in advance.

All the best,
Tina Stancheva
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
TabControl
Asked by
Jerry T.
Top achievements
Rank 1
Answers by
Jerry T.
Top achievements
Rank 1
Petar Mladenov
Telerik team
Tina Stancheva
Telerik team
Share this question
or