Telerik Forums
UI for WPF Forum
5 answers
313 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
176 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
147 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
230 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
297 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
124 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
201 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
124 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
928 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
385 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
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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
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
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?