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
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>
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.
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).
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
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
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