Telerik Forums
UI for WPF Forum
4 answers
157 views

Does anybody know what's the right way to remove the radwindow header from the tab navigation cycle?

 

<telerik:RadWindow IsTabStop="False">

is permitted but doesn't have the desired effect.

 

 

<telerik:RadWindow>

     <telerik:RadWindow.Header
        IsTabStop="False"
        >
        Manage Styles
    </telerik:RadWindow.Header>

Is not permitted... "Attribute is not allowed in property element"

 

 

Thanks

 

Michael
Top achievements
Rank 1
Veteran
 answered on 31 Jan 2018
14 answers
458 views

Hi, i'm using LinearAxis for TimeSpan values. Minimum = 1 second and Maximum - maybe 1000 days.

For values - ScatterLineSeries. In test with perfomance troubles ~500 points.

        <telerik:RadCartesianChart Zoom="10,1"

            Name="_chart" Palette="{StaticResource ScatterCustomPalette}">
            <telerik:RadCartesianChart.HorizontalAxis >
                <telerik:LinearAxis  IsStepRecalculationOnZoomEnabled="False" LabelFitMode="Rotate">
                    <telerik:LinearAxis.LabelTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Converter={StaticResource LinearAxisTimeSpanConverter}}" />
                        </DataTemplate>
                    </telerik:LinearAxis.LabelTemplate>
                </telerik:LinearAxis>
            </telerik:RadCartesianChart.HorizontalAxis>

            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis MajorStep="1"/>
            </telerik:RadCartesianChart.VerticalAxis>

            <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartPanAndZoomBehavior x:Name="_panZoomBehavior" ZoomMode="Horizontal" DragToZoomThreshold="10" />
            </telerik:RadCartesianChart.Behaviors>
        </telerik:RadCartesianChart>

Real max zoom depends from data, Axis.Maximum/coef (>1).

Its wide range for axis X, so i update major step on zoom changing. 

        private void UpdateAxisMajorStep()
        {
            var xAxis = (LinearAxis) _chart.HorizontalAxis;

            double modelWidth = xAxis.Maximum - xAxis.Minimum;
            double viewWidth = xAxis.ActualWidth > 1
                ? xAxis.ActualVisibleRange.Maximum - xAxis.ActualVisibleRange.Minimum
                : modelWidth / _chart.Zoom.Width;
            xAxis.MajorStep = viewWidth / 10;
        }

Behaviour looks good, but when i'm trying zoom in with big factor perfomance slow down.

Chart shows 10 ticks and labels at horizontal axis, but looks like

    calculated labels count = Chart.ActualRange/MajorStep. 

For example Maximum = 500000, Visible range 0 - 5000 and MajorStep = 500, count of calculated labels =  1000. Perfomance becomes unusable. 

Martin Ivanov
Telerik team
 answered on 30 Jan 2018
5 answers
712 views

Hi,

I'm using the last version of telerik and I was trying to integrate the RadPdfViewerToolBar into RadPdfViewer

This is my code

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <telerik:RadPdfViewerToolBar RadPdfViewer="{Binding ElementName=pdfViewer, Mode=OneTime}" />
     
    <telerik:RadPdfViewer Grid.Row="2" x:Name="pdfViewer" DataContext="{Binding CommandDescriptors, ElementName=pdfViewer}"                              
                            RenderOptions.BitmapScalingMode="HighQuality"     />
    <telerik:RadPdfViewerToolBar/>
</Grid>

 

I populate the pdfViewer on datacontext change

private void RootElement_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue != e.OldValue)
            {
                pdfViewer.DocumentSource = new PdfDocumentSource(new Uri(e.NewValue.ToString()));               
            }
        }

 

As shown on the attachment, the toolbar it seems not related to the pdfviewer.

Another question. Is it possible to specify a page number when I open the pdf? Something like GotoPage xy

 

Thank you

Polya
Telerik team
 answered on 30 Jan 2018
1 answer
326 views

Hi,

I have simple RadToolBar with RadRibbonButtons mostly:

<UserControl
    x:Class="EditorToolBar"
    xmlns:local="Views"
    d:DesignHeight="300"
    d:DesignWidth="300"
    mc:Ignorable="d">
    <telerik:RadToolBarTray DataContext="{Binding .}">
        <telerik:RadToolBarTray.Resources>
            <telerik:FontFamiliesProvider x:Key="FontFamiliesProvider" />
        </telerik:RadToolBarTray.Resources>
        <telerik:RadToolBar Height="32">
            <telerik:RadButtonGroup>
                <telerik:RadRibbonButton
                    Name="button"
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding PrintCommand}"
                    Size="Medium"
                    SmallImage="/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/ApplicationMenu/print.png" />
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ShowSpellCheckingDialogCommand}"
                    Size="Medium"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/EnableSpellCheck.png" />
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ShowFindReplaceDialogCommand}"
                    Size="Medium"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/Find.png"
                    Text="Find/Replace" />
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding CutCommand}"
                    CollapseToSmall="WhenGroupIsMedium"
                    Size="Medium"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/cut.png"
                    ToolTip="Cut" />
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding CopyCommand}"
                    CollapseToSmall="WhenGroupIsMedium"
                    Size="Medium"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/copy.png"
                    ToolTip="Copy" />
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding PasteCommand}"
                    CollapseToSmall="WhenGroupIsMedium"
                    Size="Medium"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/paste.png"
                    ToolTip="Paste" />
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding UndoCommand}"
                    Size="Small"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/undo.png"
                    Text="Undo" />
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding RedoCommand}"
                    Size="Small"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/redo.png"
                    Text="Redo" />
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadComboBox
                    x:Name="FontFamilySelector"
                    Width="132"
                    Height="21"
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontFamilyCommand}"
                    telerik:ScreenTip.Description="Change the font family."
                    telerik:ScreenTip.Title="Font"
                    CanAutocompleteSelectItems="False"
                    CanKeyboardNavigationSelectItems="False"
                    CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedValue}"
                    IsReadOnly="True"
                    OpenDropDownOnFocus="True" />
                <telerik:RadComboBox
                    x:Name="FontSizeSelector"
                    Width="45"
                    Height="21"
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontSizeCommand}"
                    CanAutocompleteSelectItems="False"
                    CanKeyboardNavigationSelectItems="False"
                    CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Tag}"
                    IsReadOnly="True"
                    IsTextSearchEnabled="False"
                    OpenDropDownOnFocus="True">
                    <telerik:RadRibbonComboBoxItem Content="12" Tag="16" />
                </telerik:RadComboBox>
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:FormattingColorPicker
                    x:Name="FontForeColorPicker"
                    Height="22"
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontForeColorCommand}"
                    ActiveColor="Red"
                    Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/FontForeColor.png" />
                <telerik:FormattingColorPicker
                    x:Name="FontHighlightColorPicker"
                    Height="22"
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontHighlightColorCommand}"
                    ActiveColor="Yellow"
                    AutomaticColor="Transparent"
                    Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/highlight.png"
                    NoColorText="No color" />
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ClearFormattingCommand}"
                    Size="Small"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/ClearFormatting16.png" />
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=InsertPictureCommand}"
                    Size="Medium"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/Picture.png" />
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ShowInsertHyperlinkDialogCommand}"
                    Size="Small"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/inserthyperlink.png" />
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadRibbonToggleButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleBoldCommand}"
                    Size="Small"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/bold.png" />
                <telerik:RadRibbonToggleButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleItalicCommand}"
                    Size="Small"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/italic.png" />
                <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleUnderlineCommand}" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/underline.png" />
                <telerik:RadRibbonToggleButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleStrikethroughCommand}"
                    Size="Small"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/Strikethrough16.png" />
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadRibbonToggleButton CommandParameter="Left" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeTextAlignmentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignleft.png" Text="Align Left" />
                <telerik:RadRibbonToggleButton CommandParameter="Center" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeTextAlignmentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/aligncenter.png" Text="Center" />
                <telerik:RadRibbonToggleButton CommandParameter="Right" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeTextAlignmentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignright.png" Text="Align Right" />
                <telerik:RadRibbonToggleButton CommandParameter="Justify" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeTextAlignmentCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignjustify.png" Text="Justify" />
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ToggleBulletsCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/list-bullets.png" />
                <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ToggleNumberedCommand}" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/list-numbered.png" />
                <telerik:RadRibbonDropDownButton Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/MultilevelList.png">
                    <telerik:RadRibbonDropDownButton.DropDownContent>
                        <StackPanel>
                            <telerik:RadGroupHeader Content="List Library" />
                            <telerik:RadGallery ItemHeight="88" ItemWidth="88" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ChangeListStyleCommand}" ViewportHeight="176" ViewportWidth="266">
                                <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNone.png" Tag="None" />
                                <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListBulleted.png" Tag="Bulleted" />
                                <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumbered.png" Tag="Numbered" />
                                <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumberedParenthesis.png" Tag="NumberedParenthesis" />
                                <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumberedHierarchical.png" Tag="NumberedHierarchical" />
                            </telerik:RadGallery>
                        </StackPanel>
                    </telerik:RadRibbonDropDownButton.DropDownContent>
                </telerik:RadRibbonDropDownButton>
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadRibbonButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ShowInsertSymbolWindowCommand}"
                    LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/Symbol.png"
                    Size="Large"
                    Text="Symbol" />
                <telerik:RadRibbonDropDownButton
                    CollapseToMedium="WhenGroupIsMedium"
                    Command="{Binding InsertTableCommand}"
                    LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/InsertTable.png"
                    Size="Large"
                    Text="Insert">
                    <telerik:RadRibbonDropDownButton.DropDownContent>
                        <StackPanel>
                            <telerik:RadRibbonButton ClickMode="Press">
                                <telerik:TableSizePicker Command="{Binding InsertTableCommand}" />
                            </telerik:RadRibbonButton>
                            <telerik:RadMenuItem IsSeparator="True" />
                            <telerik:RadRibbonButton
                                HorizontalAlignment="Stretch"
                                telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ShowInsertTableDialogCommand}"
                                Size="Medium"
                                SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/InsertTable.png"
                                Text="Insert Table..." />
                        </StackPanel>
                    </telerik:RadRibbonDropDownButton.DropDownContent>
                </telerik:RadRibbonDropDownButton>
            </telerik:RadButtonGroup>
            <telerik:RadToolBarSeparator />
            <telerik:RadButtonGroup>
                <telerik:RadRibbonToggleButton
                    VerticalAlignment="Bottom"
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ToggleSubscriptCommand}"
                    Size="Small"
                    SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/subscript.png" />
                <telerik:RadRibbonToggleButton
                    telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ToggleSuperscriptCommand}"
                    LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/superscript.png"
                    Size="Small" />
            </telerik:RadButtonGroup>
        </telerik:RadToolBar>
    </telerik:RadToolBarTray>
</UserControl>

 

Its task is to execute RichTextBox commands.

So I created a binding for commands property:

<local:EditorToolBar
            x:Name="DescEditorToolbar"
            Grid.Column="0"
            DataContext="{Binding ElementName=DescEditor, Path=Commands}" />
 
<telerik:RadRichTextBox
            x:Name="DescEditor"
            Grid.Row="2"
            Margin="1,2,0,0"
            telerik:XamlDataProvider.Source="{Binding Description, Mode=TwoWay}"
            BorderThickness="0"
            DocumentInheritsDefaultStyleSettings="True"
            FontFamily="Verdana"
            FontSize="16"
            IsImageMiniToolBarEnabled="False"
            IsSelectionMiniToolBarEnabled="False"
            IsSpellCheckingEnabled="False" LayoutMode="Paged"/>    

 

At application start, property Description in ViewModel is filled with empty RadDocument xaml string and then user can edit it. It works fine, but for unknown reasons sometimes after application start, toolbar looks like it isn't binded to RichTextBox commands. Pressing Toolbar buttons doesn't change anything in edited Document. It looks like Toolbar and RichTextBox are not connected in any way.

 

Commands in RadRichTextBox are fine, because ctrl+z is working. Should I perform some refresh actions on Toolbar or something?

 

Thanks for any help,

Jakub.

Peshito
Telerik team
 answered on 30 Jan 2018
5 answers
354 views

Hi,

I'm having a lot of difficulties in understanding how to create the layout that I am looking for with RadDocking.  I have read the documentation and have looked at the examples however I am still having difficulties.

https://docs.telerik.com/devtools/wpf/controls/raddocking/getting-started/getting-started2#adding-radpane

Is it possible for someone to help me understand how to create the layout attached in my wireframe?

I am having a hard time getting tabs to be on the left, how to size things with RadSplitContainer and understanding the need of DocumentHost.

Thank you.

David

Kalin
Telerik team
 answered on 30 Jan 2018
11 answers
190 views

Hi,

We are using the RadMap control (v. 4.0.30319) in a MVVM WPF project .

In some cases we encounter an exception on the AsyncShapeFileReader while calling ReadAsync()

Exception Message: collection was modified; enumeration operation may not execute

Telerik.windows.controls.Map.MapShapeDataVirtualizationSource.QueryItems ( line 440)

I thought it was a cross-threading problem and inserted some changes in my code :

- calling this.Dispatcher.Invoke((Action)(() => AsyncShapeFileReaderObj. ReadAsync() ));       

- using async/ await

but both changes did not solved the problem and the exception still rize.

what could be the problem? Do you have another idea how can i solved it? 

The Main thread is calling the ReadAsync() and the other threads that i could see are background workers of Telerik's Map ...

Thanks,

Tali

 

 

 

Petar Mladenov
Telerik team
 answered on 30 Jan 2018
1 answer
164 views

Hello

I have complex class like this:

class person
    {
        string name;
        car Car;
    }
    
    class car
    {
        string model;
        string number;
    }

////////////////////////

 ObservableCollection<person> persons  = getAllPerson() ;

mainDG.ItemSource = persons;

////////////////////////

How can I bind it to my RadgridView?

<telerik:RadGridView x:Name="mainDG" Margin="259,0,5,5" AutoGenerateColumns="False" >
                        <telerik:RadGridView.Columns>

                                  <telerik:GridViewDataColumn Header="Car number" DataMemberBinding="{Binding Car.number}"/>//How can I bind it?

                       </telerik:RadGridView.Columns>

</telerik:RadGridView>

Anatol
Top achievements
Rank 1
 answered on 30 Jan 2018
0 answers
255 views

Hello Telerik,

 

On my project, I have a RadDiagram with some shapes, and inside, text is defined.

I need to export this RadDiagram to a PDF File > I create a Bitmap Image from the RadDiagram, and insert this image in the PDF file.

However, texts in the PDF should be selectables. So, before the export, I hide all of texts, and I write them directly inside the PDF after it generation.

 

From a Textblock, I save primordial informations, and hide the text :

Dim ptb As New ParsedTextBlock(tb.Name, tb.Text, tb.ActualWidth, tb.ActualHeight, rotation, CType(tb.HorizontalAlignment, Windows.Forms.HorizontalAlignment),
                               tb.FontSize, tb.FontStyle, tb.FontFamily, tb.Foreground, tb.FontStretch, tb.FontWeight, tb.Background,
                               tb.TransformToAncestor(diag).Transform(New Windows.Point(0, 0)))

 

tb.Visibility = Windows.Visibility.Collapsed

ParsedTextBlock is a custom class to store some properties.

 

After, I have some methods to export Textblock :

Public Sub ExportSummaryDiagTextBlocks(diag As RadDiagram, vector As Windows.Vector)
    Dim diagItems As List(Of RadDiagramItem) = diag.Items.Select(Function(i) diag.ContainerGenerator.ContainerFromItem(i)).OrderBy(Function(c) c.ZIndex).ToList()
    Dim diagShapes As List(Of RadDiagramShape) = diagItems.OfType(Of RadDiagramShape).ToList()
    Dim vectorFromPdfOrigin As New Windows.Vector(40, 70)  '40,70 is some fune tuning and should be modified if pageSize / layout is modified
 
    Dim w As Single = ReportPageSize.GetWidth
    Dim wRatioDiag As Single = WIDTH_RATIO_SUMMARY_FOR_DIAG_IMG
    Dim legacyRectRatio As Double = Rect_Summary.Width / Rect_Summary.Height
    Dim rectDiagSummary As New Geom.Rectangle(CSng(vectorFromPdfOrigin.X), CSng(vectorFromPdfOrigin.Y), CSng(w * wRatioDiag), CSng(w * wRatioDiag / legacyRectRatio))
    Dim windowsRectDiagSummary As New Windows.Rect(0, 0, CSng(w * wRatioDiag), CSng(w * wRatioDiag / legacyRectRatio))
    Dim wRatioNewRectVersLegRect As Double = rectDiagSummary.GetWidth / Rect_Summary.Width
 
    Me._ptb.ForEach(Sub(ptb) ExportTextBlock(ptb, diag, Rect_Summary, rectDiagSummary, vector, New Windows.Vector(40, 70)))
End Sub

Me._ptb is a list of ParsedTextBlock.

 

Private Sub ExportTextBlock(ptb As ParsedTextBlock, diag As RadDiagram, diagRect As Windows.Rect, pdfRect As Geom.Rectangle, transformVector As Windows.Vector, vectorFromPdfOrigin As Windows.Vector)
    Dim p As Windows.Point = CalculateCoordForExport(diag, ptb, diagRect, pdfRect, transformVector, vectorFromPdfOrigin)
    Dim font As PdfFont = PdfFontFactory.CreateRegisteredFont(ptb.FontFamily.ToString(), PdfEncodings.IDENTITY_H, True,
                                                              FontHelper.ConvertWeightToPdfStyleInteger(ptb.FontWeight, (ptb.FontStyle = Windows.FontStyles.Italic)))
    Dim para As Paragraph = New Paragraph(ptb.Text).SetFont(font)
    Dim wRatioNewRectVersLegRect As Double = pdfRect.GetWidth / diagRect.Width
    Dim fontSize As Single = CSng(Math.Round(ptb.FontSize * wRatioNewRectVersLegRect, 1))
    If fontSize < 3 Then fontSize = 3
 
    Dim w As Double = ptb.Width * wRatioNewRectVersLegRect
    para.SetPadding(0)
    para.SetMargin(0)
    para.SetFixedPosition(Convert.ToSingle(p.X), Convert.ToSingle(p.Y), CSng(w))
    para.SetFontSize(fontSize)
    'para.SetFontSize(CSng(ptb.FontSize))
    para.SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER)
    para.SetVerticalAlignment(VerticalAlignment.MIDDLE)
    para.SetBackgroundColor(ColorHelper.ConvertBrushToDeviceRgb(ptb.Background))
    Dim rot As Double = ptb.Rotation ' GetRotation(tb)
    If rot <> 0 Then
        'Dim rot_radian As Double = ((-rot + 360) Mod 360) * Math.PI / 180.0 ' I multiply because WPF is counterclockwise but PDF is clockwise
        Dim rot_radian As Double = -(rot * (Math.PI / 180))
        para.SetRotationAngle(rot_radian)
    End If
 
    _doc.Add(para)
End Sub

 

And :

Private Function CalculateCoordForExport(diag As RadDiagram, tb As ParsedTextBlock, diagRect As Windows.Rect, pdfRect As Geom.Rectangle, transformVector As Windows.Vector,
                                         vectorFromPdfOrigin As Windows.Vector) As Windows.Point
    Dim oldPoint As Windows.Point = tb.Coordinates ' tb.TransformToAncestor(diag).Transform(New Windows.Point(0, 0))
    oldPoint = New Windows.Point(oldPoint.X - transformVector.X, oldPoint.Y - transformVector.Y)
 
    '2 appliquer le crop
    Dim pointAfterCrop As Windows.Point = CoordinateHelper.ApplyCrop(oldPoint, New Windows.Point(Me.Rect_Summary.X, Me.Rect_Summary.Y))
 
    '3 appliquer le resizing
    Dim pointAfterResising As Windows.Point = CoordinateHelper.CalculatePointAfterResizing(pointAfterCrop, diagRect, pdfRect)
 
    '4 appliquer le Y reverse. car l'origine du raddiagram est en haut à gauche tandis que pour iText, c'est en bas à gauche
    Dim pointAfterReversingY As Windows.Point = New Windows.Point(pointAfterResising.X, pdfRect.GetHeight - pointAfterResising.Y)
 
    '5 appliquer decalage nouvel origine
    Dim pointAfterNewOrigin As Windows.Point = Windows.Vector.Add(vectorFromPdfOrigin, pointAfterReversingY)
 
    '6 soustraire à Y la Height de la shape car l'origine du raddiagram est en haut à gauche tandis que pour iText, c'est en bas à gauche
    Dim heightRatio As Double = pdfRect.GetHeight / diagRect.Height
    Dim pointAfterMinusHeight As New Windows.Point(pointAfterNewOrigin.X, pointAfterNewOrigin.Y - (tb.Height * heightRatio))
 
    Return pointAfterMinusHeight
 
End Function

 

With these methods, for a text not rotated, it's OK. But the problem is when the text is rotated.

You can see the Origin screen, this one is the RadDiagram before exportation, and the Result screen, this one is the result inside the PDF.

And depending to the rotation angle, the result for rotated text is so bad.

 

My excpectation is that the position from the TextBlock is bad (calculation is false ?)...

 

I hope you can help me to write at the good place a rotated TextBlock.

 

Thank you.

Valentin
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 29 Jan 2018
1 answer
325 views

I'm getting a parameter count mismatch, I narrowed it down to an indexed property on the viewmodel that the data form is bound to, but not even using.

 

System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
Telerik.Windows.Controls.RadDataForm.OnCurrentItemPropertyChanged(Object sender, String propertyName)
Telerik.Windows.Controls.RadDataForm.OnCurrentItemPropertyChanged(Object sender, PropertyChangedEventArgs e)
System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)

 

I saw in the forum other references to this error and some with very similar stack traces. Most said a fix would be in the next version. Is there something I am doing wrong, or is this just a bug in the data form? Is there a way I can override OnCurrentItemPropertyChanged and handle it myself (or skip it in this case, of not actually even using the parameter).

Martin
Telerik team
 answered on 29 Jan 2018
1 answer
150 views

Hi Progress Telerik,

I would like to change the look of the Relation Arrow between tasks. Is there any way to style the relation arrow in GanttView? Please provide the solution to achieve the same.

 

Thanks and Regards,

Muhammad Azhar Shah

MSC Technology

Martin
Telerik team
 answered on 29 Jan 2018
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?