Telerik Forums
UI for WPF Forum
11 answers
158 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
138 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
216 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
279 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
119 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
2 answers
194 views
I am using the RadScheduleView with only the MonthViewDefinition.  In my application, there is no more than a single appointment per day.  I want the appointment to stretch vertically to fill the cell for that day.  I have tried increasing the MinAppointmentHeight property, but anything over 83 causes an expand button to be shown, and the appointment is not visible until I click the expand button.  Also, the bottom portion of the day is taken up by the expand button, when I want to use the appointment for the entire area.  I've attached several screenshots showing the current behavior, and an edited screenshow showing the desired behavior.
Brandon
Top achievements
Rank 1
Veteran
 answered on 27 Jan 2018
5 answers
115 views

Here's the behaviour i'm looking for:

With focus on my combobox, I press 'n' once. -> The first item in the list starting with 'n' is selected.

I press 'n' again. -> The second 'n' item in the list is selected.

-------

Is there a combination of flags that causes this behavior?

If not, has anybody already written the event handler to make it work?

Cheers

Michael
Top achievements
Rank 1
Veteran
 answered on 26 Jan 2018
2 answers
899 views
If I have a string value that represents a decimal number (e.g. "15.123") the current default double click behavior is to select only the text before or after the decimal.  How can I change this to select all text in the field on double click?
Karl B
Top achievements
Rank 1
 answered on 26 Jan 2018
8 answers
377 views
How do I programmatically focus to the first (or any) row in my RadGridView. I can select the record and scroll to the record programmatically just fine, but it seems as if I can't get keyboard focus on the rows without first clicking into one.

Maybe I'm missing something obvious.
Nebojsa Mancic
Top achievements
Rank 2
 answered on 26 Jan 2018
2 answers
216 views

Hi,

Firstly, we were extremely glad to see the ability of having frozen columns on both the left and the right added to an already great product so thanks for that.

I have been asked to find out if there is a way we can have a visible distinction akin to the split column but without allowing the user to actually move / set what columns are frozen.

is this something that can be achieved easily with a style or is there already a property I am missing that will show the Left/Right FrozenColumnsSplitter but not allow the splitter to be moved?

 

Many thanks in advance for your help with this

Lee
Top achievements
Rank 1
 answered on 26 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
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?