Telerik Forums
UI for WPF Forum
4 answers
259 views

Hello,

I'm getting a Dictionnary exception when using the Import function of the RtfFormatProvider in a Task.

Here's an example of the code that is run:

Private Async Sub LoadItems
   Dim loadingTasks As New List(Of Task)
   '-- Async task #1
   loadingTasks.Add(Task.Run(Function() LoadData1(paramObj)))
   '-- Async task #2
   loadingTasks.Add(Task.Run(Function() LoadData2(paramObj)))
End Sub
 
Private Function LoadData1(paramObj As Object)
   Dim objectList = New List(Of MyItemClass)
 
   objectList.AddRange(New ObservableCollection(Of MyItemClass)(MyItemClass.GetAll())
 
   Return objectList
End Function
 
'In MyItemClass:
Public Function GetAll() As List(Of MyItemClass)
   '[Some code...]
   Dim frmtValue As String
   '[Some more code...]
   Dim doc As New RadDocument()
   Dim rfp As New RtfFormatProvider()
 
   doc = rfp.Import(frmtValue) 'The exception is triggered here
   '[Some code...]
End Function

 

I'm loading items in parralel using Tasks.

Those items have a property bound to a RichTextBox and I'm deserializing the RTF string in a RadDocument through a RtfFormatProvider.

The code worked fine when I didn't use the Tasks and called the function in a synchronous way. However, since I switch to Tasks, I get the follwing error on the Import method:

"An item with the same key has already been added"

at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at Telerik.Windows.Documents.FormatProviders.ReplaceStyleNameHandler.Add(String displayName, String name)
   at Telerik.Windows.Documents.FormatProviders.ReplaceStyleNameHandler.InitializeStyleDisplayNameToStyleNameDictionary()
   at Telerik.Windows.Documents.FormatProviders.ReplaceStyleNameHandler.get_StyleDisplayNameToStyleName()
   at Telerik.Windows.Documents.FormatProviders.ReplaceStyleNameHandler.TryGetStyleNamesByStyleName(String displayName, RadDocumentDefaultStyleInfo& defaultStyleInfo)
   at Telerik.Windows.Documents.FormatProviders.ReplaceStyleNameHandler.Replace(ReplaceStyleNameContext context)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfStyleImporter.DoVisitText(RtfText text)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfElementIteratorBase.VisitElement(RtfElement element, Boolean recursive)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfElementIteratorBase.VisitGroupChildren(RtfGroup group, Boolean recursive)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfStyleImporter.ImportStyleGroup(RtfGroup group)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfStylesTable.FillStyle(RtfGroup group, StyleType type, Boolean isDefault)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfStylesTable.DoVisitGroup(RtfGroup group)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfElementIteratorBase.VisitElement(RtfElement element, Boolean recursive)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfElementIteratorBase.VisitGroupChildren(RtfGroup group, Boolean recursive)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfStylesTable.ReadTable(RtfGroup group, RtfImportContext context)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfHandlers.RtfGroupHandlers.StylesTableHandler(RtfGroup group, RtfImportContext context)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfDocumentImporter.DoVisitGroup(RtfGroup group)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfElementIteratorBase.VisitElement(RtfElement element, Boolean recursive)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfElementIteratorBase.VisitGroupChildren(RtfGroup group, Boolean recursive)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfDocumentImporter.ImportRoot(RtfGroup rtfGroup)
   at Telerik.Windows.Documents.FormatProviders.Rtf.Import.RtfDocumentImporter.Import(Stream input, RtfImportSettings settings)
   at Telerik.Windows.Documents.FormatProviders.Rtf.RtfFormatProvider.Import(Stream input)
   at Telerik.Windows.Documents.FormatProviders.Rtf.RtfFormatProvider.Import(String input)

 

(PS: The code has been tested with the latest release of UI for WPF)

 

I don't suppose the RtfFormatProvider has a hidden ConcurrentDictionary somewhere that could solve this? :)

Do you know if what I'm trying to acheive is possible?

Boby
Telerik team
 answered on 28 Sep 2018
3 answers
164 views

I am saving the layout using the savelayout method on the docking control.

This works fine (although i have no pane titles but that is another question) until I float panes on external monitors (I have 3). 

When I do this and I use the save layout method I get an error 'Managed Debugging Assistant: 'FatalExecutionEngineError'. The runtime has encountered a fatal error. The address of the error was at 0x65bf395f, on thread 0x4548. The error code is 0x80131623. This error may be a bug in the CLOR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

My code (in the Window closing event) is:

MemoryStream stream = new MemoryStream();
DockMain.SaveLayout(stream);

stream.Seek(0, SeekOrigin.Begin);

StreamReader reader = new StreamReader(stream);

var layout = reader.ReadToEnd();

Then i persist layout to a file.

 

Can you please assist.

 

Rob

Dilyan Traykov
Telerik team
 answered on 27 Sep 2018
2 answers
263 views

Hi,

Based on this ( https://www.telerik.com/forums/cannot-implicitly-convert-type-radwindow-to-window )

i tried to get the HostWindow in an mvvm + prism with prismapplication.

But it failed in CreateShell() the Shell is a RadWindow and is created but there is no HostWindow retuned and so it will not work.

Maybe because in PRism the changed the return Type to Window ( i think it was DependencObject before ) 

but so what can i do to return the Shell here ? 

thanks br

thomas

 

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
    containerRegistry.RegisterSingleton<ShellWindow>();
}
 
protected override Window CreateShell()
{
    var shellwin = Container.Resolve<ShellWindow>();
    var appwin = Window.GetWindow(shellwin);
    return appwin;
}

 

Thomas
Top achievements
Rank 1
 answered on 27 Sep 2018
1 answer
287 views

I want to be able to toggle between the different orientations of the schedule view. I have a property bound to my view model but this doesn't seem to be working. I have tried different variations. Can someone tell me what i may be missing?

<p><telerik:TimelineViewDefinition  VisibleDays="30" <br>                                                     x:Name="TimelineViewDefinition"<br>                                                     MajorTickLength="1d" <br>                                                     Orientation="{Binding DataContext.ScheduleViewOrientation, RelativeSource={RelativeSource Mode=FindAncestor,                                                                                             AncestorType=telerik:RadScheduleView}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"</p><p>                                                     StretchAppointments="True"<br>                                                     MinorTickLength="1d"  <br>                                                     GroupHeaderDateStringFormat="MM-dd"<br>                                                     StretchGroupHeaders="False" ></p>




Dilyan Traykov
Telerik team
 answered on 26 Sep 2018
1 answer
218 views

Hello,

when I start a brand new Telerik WPF project, and want to add a RadGridView component to the main window, the following error message shows:

Method not found: 'Telerik.Windows.Controls.SortingState Telerik.Windows.Controls.GridViewColumn.get_SortingState()'.

I just upgraded to the latest Telerik WPF version.

Please advise.

Thx

Vladimir Stoyanov
Telerik team
 answered on 26 Sep 2018
1 answer
173 views

How do you turn off the animation when the filter popup expands and/or collapses as it opens? For other Rad controls, such as RadTreeView, settings

 telerik.IsAnimationEnabled="False" 

works. Putting this in the XAML of the RadGridView does not work, however.

 

Any help would be appreciated. Thank you

 

 

Dilyan Traykov
Telerik team
 answered on 26 Sep 2018
5 answers
140 views

Hi Progress Telerik,

When I type the date 01 09 18, the tooltip suggests 18 Sep 2001.

But when I type 01 09 2018, the tooltip suggests 01 Sep 2018.

I want the suggestion date to be 01 Sep 2018 when I type 01 09 18.

I'm using the CultureInfo en-US and date format dd MMM yyyy.

Kindly assist on how to achieve the same.

 

Thank You,

With Best Regards,

Muhammad Azhar Shah

Premkumar
Top achievements
Rank 1
 answered on 26 Sep 2018
2 answers
308 views

We are using telerik RadrichTextbox in our wpf application. 

When user is entering some space before/after the text.please tell how to trim it of ?

Priyatam
Top achievements
Rank 1
 answered on 25 Sep 2018
5 answers
618 views
Hello!

Im trying to create CustomGridView component by creating WPF CustomControl (control inherits telerik RadGridView). I realized that my custom control style is not loaded. I made simple example about this problem. Example should change my custom control background to blue but it does not.

my cs. file
public class MyCustomGridView : RadGridView  
{   
     static MyCustomGridView()
     {   
        DefaultStyleKeyProperty.OverrideMetadata(typeof(MyCustomGridView), new FrameworkPropertyMetadata(typeof(MyCustomGridView)));
     }  
  
     protected override void OnInitialized(EventArgs e)
     {         
        base.OnInitialized(e);       
     }    
 }

and here is my Generic.xaml in themes folder

<Style TargetType="{x:Type local:MyCustomGridView}">   

<Setter Property="Background" Value="Blue"></Setter>
  
 <Setter Property="Template">
         <Setter.Value>   
             
<ControlTemplate TargetType="{x:Type local:MyCustomGridView}">
                    <Border Background="{TemplateBinding Background}"    
                         BorderBrush="{TemplateBinding BorderBrush}"  
                           BorderThickness="{TemplateBinding BorderThickness}">
                    </Border>          
       
</ControlTemplate>      
       
</Setter.Value>      
   
</Setter>  </Style>

So basically this is classic start for WPF custom control, but in runtime this is not working. Am I missing something ?

Best regards


Dilyan Traykov
Telerik team
 answered on 25 Sep 2018
0 answers
103 views

Hello,

I have problem with RadRibbonViewBackstage. My window shell contains two regions in separate rows. In First region I registered view containing RibbonView with RibbonViewBackstage. In second i defined statusbar view. When ribbonView's backstage is closed everything looks fine (First region and second shares window space). Problem appears when I open backstage. Backstage View is always taking whole window space and my status bar dissapears under. Is there any option to make Backstage same size as region in which i is defined so it will leave space for bottom status bar?

Thanks for your help :)

Maciej
Top achievements
Rank 1
 asked on 25 Sep 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?