Telerik Forums
UI for WPF Forum
1 answer
326 views

Hi

I am using Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider() to convert a word document(.docx) to pdf.

This takes a lot of time and gives system out of memory exception when the number of pages in the word document is more than 500.

 

Below is the code snippet:

using (Stream input = new FileStream("temp.docx"), FileMode.Open))

                {
                    var providerDocx = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
                    var document = providerDocx.Import(input);

                    var providerPdf = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();

                    Stream outStream = new MemoryStream();
                    providerPdf.Export(document, outStream);

                    var fileStream = File.Create("temp.pdf");
                    outStream.Seek(Constants.Int0, SeekOrigin.Begin);
                    outStream.CopyTo(fileStream);
                    fileStream.Close();
                }

 

Please suggest a solution to this or any other alternative which takes less time and memory.

 

Dimitar
Telerik team
 answered on 24 Jun 2021
1 answer
205 views

Downloading and running the WPF UI demo gives an error. Installer log shows:

The following properties have been set:
Property: [AdminUser] = true {boolean}
Property: [InstallMode] = HomeSite {string}
Property: [ProcessorArchitecture] = AMD64 {string}
Property: [VersionNT] = 6.2.0 {version}
Running checks for package 'Windows Installer 4.5', phase BuildList
Looking up path for special folder 'WindowsFolder'
Running check with folder 'C:\Windows\System32' and file 'msi.dll'
Attempting to find file 'C:\Windows\System32\msi.dll'
File version is '5.0.19041.928'
Setting value '5.0.19041.928 {version}' for property 'VersionMsiDll'
The following properties have been set for package 'Windows Installer 4.5':
Property: [VersionMsiDll] = 5.0.19041.928 {version}
Running checks for command 'WindowsInstaller4_5\WindowsXP-KB942288-v3-x86.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': true
Result of checks for command 'WindowsInstaller4_5\WindowsXP-KB942288-v3-x86.exe' is 'Bypass'
Running checks for command 'WindowsInstaller4_5\WindowsXP-KB958655-v2-x86-ENU.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsiDll' and value '4.5.6001.22299': true
Result of checks for command 'WindowsInstaller4_5\WindowsXP-KB958655-v2-x86-ENU.exe' is 'Bypass'
Running checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-x86.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': true
Result of checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-x86.exe' is 'Bypass'
Running checks for command 'WindowsInstaller4_5\WindowsServer2003-KB958655-v2-x86-ENU.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsiDll' and value '4.5.6001.22299': true
Result of checks for command 'WindowsInstaller4_5\WindowsServer2003-KB958655-v2-x86-ENU.exe' is 'Bypass'
Running checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-x64.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '4.5': true
Result of checks for command 'WindowsInstaller4_5\WindowsServer2003-KB942288-v4-x64.exe' is 'Bypass'
Running checks for command 'WindowsInstaller4_5\WindowsServer2003.WindowsXP-KB958655-v2-x64-ENU.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsiDll' and value '4.5.6001.22299': true
Result of checks for command 'WindowsInstaller4_5\WindowsServer2003.WindowsXP-KB958655-v2-x64-ENU.exe' is 'Bypass'
Running checks for command 'WindowsInstaller4_5\Windows6.0-KB958655-v2-x86.MSU'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsiDll' and value '4.5.6001.22308': true
Result of checks for command 'WindowsInstaller4_5\Windows6.0-KB958655-v2-x86.MSU' is 'Bypass'
Running checks for command 'WindowsInstaller4_5\Windows6.0-KB958655-v2-x64.MSU'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsiDll' and value '4.5.6001.22308': true
Result of checks for command 'WindowsInstaller4_5\Windows6.0-KB958655-v2-x64.MSU' is 'Bypass'
'Windows Installer 4.5' RunCheck result: No Install Needed
Launching Application.
URLDownloadToCacheFile failed with HRESULT '-2146697208'
Error: An error occurred trying to download 'https://demos.telerik.com/wpf/WPF%20Demos.application'.
Dilyan Traykov
Telerik team
 answered on 24 Jun 2021
2 answers
154 views

Hello.

 

It will be easier to understand if you refer to the image.
The user wants to independently enable the navigation item according to the user's selection.

My example created a structure like that, but it doesn't work.

Is there any good way?

 

Thanks.

 

p.s - In combination with the above functions, can I control A and B Views with Enable at the same time by adding a C Button(True/False)?

Dinko | Tech Support Engineer
Telerik team
 answered on 24 Jun 2021
1 answer
239 views
I have a data-driven application architecture and my expectation is that MultipleSelectionBoxTemplate shares the same DataContext as the parent RadComboBox because it does not apply to any particular item. This is very confusing.
Martin Ivanov
Telerik team
 answered on 23 Jun 2021
1 answer
141 views

Is it possible to remove RadDiagramShape-Connectos at runtime (I've created my own shape-class: BaseNodeShape : RadDiagramShape)?

If I'm calling Connectors.Clear(), the connectors are not removed from the shape, do I need to start/end editing or something like that?

I'm creating connectors like that, since the code is called multiple times, I also need to remove old connectors. But old connectors just stay in ths shape.


/// <summary>
        /// Creates connectors and calls LoadConnectorText method
        /// </summary>
        public virtual void CreateConnectors()
        {
            if (ViewModel?.DataPins == null || ViewModel?.FlowPins == null)
                return;

            int longestTextLength = 0;
            
            FlowConnectors?.Clear();
            DataConnectors?.Clear();
            Connectors?.Clear();
            
            // Fill connector list
            foreach (var pin in ViewModel.DataPins)
            {
                var dataConnector = new DataConnector(pin.Name, pin.DisplayName,
                    pin.PinDirection == PinDirectionDefinition.In ? ConnectorDirection.In : ConnectorDirection.Out,
                    pin.DataConnectorType, pin.IsGeneric, pin.AllowedTypes)
                {
                    DataContext = pin
                };
                
                DataConnectors.Add(dataConnector);

                if (dataConnector.Name.Length > longestTextLength)
                    longestTextLength = dataConnector.Name.Length;
            }

            foreach (var pin in ViewModel.FlowPins)
            {
                var flowConnector = new FlowConnector(pin.Name, pin.DisplayName,
                    pin.PinDirection == PinDirectionDefinition.In ? ConnectorDirection.In : ConnectorDirection.Out)
                {
                    DataContext = pin
                };

                FlowConnectors.Add(flowConnector);

                if (flowConnector.Name.Length > longestTextLength)
                    longestTextLength = flowConnector.Name.Length;
            }

            var headerWidth = 15 + (ViewModel.DisplayName.Length * 8);
            var totalLineWidth = longestTextLength * 10;

            if (headerWidth < totalLineWidth)
                ViewModel.Width = totalLineWidth;
            else
                ViewModel.Width = headerWidth;

            if (ViewModel.Width < 50)
                ViewModel.Width = 50;

            const double heightPerDataPin = 20;
            const double heightPerFlowPin = 20;
            const double baseHeight = 35;

            var flowInPinCount = FlowConnectors.Count(x => x.ConnectorDirection == ConnectorDirection.In);
            var dataInPinCount = DataConnectors.Count(x => x.ConnectorDirection == ConnectorDirection.In);
            var flowOutPinCount = FlowConnectors.Count(x => x.ConnectorDirection == ConnectorDirection.Out);
            var dataOutPinCount = DataConnectors.Count(x => x.ConnectorDirection == ConnectorDirection.Out);

            if ((flowInPinCount * heightPerFlowPin + dataInPinCount * heightPerDataPin) > (flowOutPinCount * heightPerFlowPin + dataOutPinCount * heightPerDataPin))
            {
                var flowPinsHeight = heightPerFlowPin * flowInPinCount;
                var dataPinsHeight = heightPerDataPin * dataInPinCount;
                ViewModel.Height = baseHeight + flowPinsHeight + dataPinsHeight + 5;
            }
            else
            {
                var flowPinsHeight = heightPerFlowPin * flowOutPinCount;
                var dataPinsHeight = heightPerDataPin * dataOutPinCount;
                ViewModel.Height = baseHeight + flowPinsHeight + dataPinsHeight + 5;
            }

            double heightOffset = (35 / ViewModel.Height);
            double rowMargin = (18 / ViewModel.Height);
            double xLeft = (8 / ViewModel.Width); // 0.04;
            double xRight = 1 - xLeft;
            double yTop = heightOffset;

            foreach (var flowConnector in FlowConnectors
                .Where(connector => connector.ConnectorDirection == ConnectorDirection.In))
            {
                flowConnector.Offset = new Point(xLeft, yTop);
                this.Connectors.Add(flowConnector);
                yTop += rowMargin;                
            }

            foreach (var dataConnector in DataConnectors
                .Where(connector => connector.ConnectorDirection == ConnectorDirection.In))
            {
                dataConnector.Offset = new Point(xLeft - 0.01, yTop);
                this.Connectors.Add(dataConnector);
                yTop += rowMargin;                
            }

            yTop = heightOffset;
            foreach (var flowConnector in FlowConnectors
                .Where(connector => connector.ConnectorDirection == ConnectorDirection.Out))
            {
                flowConnector.Offset = new Point(xRight, yTop);
                this.Connectors.Add(flowConnector);
                yTop += rowMargin;
            }

            foreach (var dataConnector in DataConnectors
                .Where(connector => connector.ConnectorDirection == ConnectorDirection.Out))
            {
                dataConnector.Offset = new Point(xRight, yTop);
                this.Connectors.Add(dataConnector);
                yTop += rowMargin;
            }
        }
Dinko | Tech Support Engineer
Telerik team
 answered on 22 Jun 2021
1 answer
738 views

Hope somebody can help out here.

We have recently started using the RadSyntaxEditor in an application that uses the Prism framework. There have been some posts about the SyntaxEditor not showing in the UI unless you put it in a ContentControl. We did this and bound the Content to the SyntaxEditor instance in the VM.

This worked fine and we can add a custom tagger but none of the event subscriptions to the Document.TextContentChanged event seem to work.

If we then template the SyntaxEditor in the XAML and bind to an instance of the TextDocument like this, how do you set up a custom tagger?

<ControlTemplate x:Key="SyntaxEditorControlTemplate" TargetType="{x:Type ContentControl}">
            <telerik:RadSyntaxEditor AutoScrollToCaretOnTextChange="True"
                                      CaretDisplayMode="Block"
                                      Document="{Binding SyntaxTextDocument}">

            </telerik:RadSyntaxEditor>
</ControlTemplate>

Can anybody point us to an example of using the SyntaxEditor with MVVM please.

Thanks

Vladimir Stoyanov
Telerik team
 answered on 21 Jun 2021
1 answer
321 views

Hi,

I am having a WPF window with few grids containing rows varying from 2-100.  When I click on a link from a previous window, this window has to be loaded. I have used RadBusyIndicator for the entire content. And the grid population  LoadData() is being done in Tasks which is called on Window Loading. So presently my UI is displayed with all the grid without any contents and maybe after 4-5 seconds, the contents are loaded. 

I want to display the RadbusyIndicator when no contents are present and once the contents appear, it should disappear. Please find the below code I have implemented.  But in this case, RadBusyIndicator is not displayed. Kindly help.

An alternative that works presently is to put DisplayAfter = 0, here the indicator appears though it doesn't spin and later vanish when data loads.

public void LoadData( string filePath)

        {
            this.IsBusy = true;

            Task.Factory.StartNew(() => {
                OnPopulateDataDoWork(filePath);
            }).ContinueWith(t =>
            {
                this.IsBusy = false;
            }, TaskScheduler.FromCurrentSynchronizationContext());


Thanks,

Divya

 

Vladimir Stoyanov
Telerik team
 answered on 21 Jun 2021
1 answer
256 views
I'm using the implicit Fluent theme.

If you look at my ResourceTemplate.xaml, there is a Fluent theme and a Transparent theme.
Telerik.Windows.Controls only applies the transparent theme.

Is there a way to change only BusyIndicator to Transparent theme?
I want the main window to be a fluent theme.
(I know that Style.Manager shouldn't be for implicit styles.)

If you click the button, BusyIndicator opens a new window and works. But there is a problem.
BusyContent is incremented by 1 only internally.
However BusyIndicator is not displayed, only blank.
What's wrong?

Please check my source for details.

Thank you.
Dinko | Tech Support Engineer
Telerik team
 answered on 21 Jun 2021
1 answer
149 views

In VS 2019 I got prompted to update to a new version R2 2021 SP1.  I accepted and got the download window, in the download window I clicked on "Release Notes" and my Chrome browser opened with page of notes.

I return to VS and the download shows 100% complete but both the "Cancel" and "Minimize" buttons are grayed out.  Waited about 10 minutes and still the same, so I had to "End Task" VS 2019.

Rob.

Nikolay Mishev
Telerik team
 answered on 18 Jun 2021
3 answers
166 views

Hello,

i have an issue using RadCartesianChart with mixed Series types. All series have the same ItemsSource. I know if there are too much Datapoints the chart filters some points. The problem is that not on all series the same datapoints are filtered.

In the first picture you can see that there is no Datapoint for the StepLineSeries at 16:34:29, the next closest point is at 16:34:16. It is filtered out because there are too much datapoints for this range. This would be ok if it is also filtered out at the RangeSeries.

In the second picture we are zoomed in and we see that the point is no more filtered.

In the third picture i used for all 3 series the same series type (unzoomed). Now all serieses are filtered correct the same Datapoints.

How can i change this behavior of the Chart that all series types do the filtering the same way? In my opinion this behavior is wrong. I would expect the bevavior of Picture three also for different series types.

<telerik:RadCartesianChart.Series>
          <telerik:StepLineSeries DisplayName="Value" Stroke="DodgerBlue" StrokeThickness="1" ItemsSource="{Binding Data}" CategoryBinding="Timestmp" ValueBinding="Value"></telerik:StepLineSeries>
          <telerik:RangeSeries DisplayName="MinValue" Stroke="#88FF0000" StrokeThickness="1" Fill="#44FF0000" ItemsSource="{Binding Data}" CategoryBinding="Timestmp" LowBinding="LowBinding" HighBinding="MinValue"></telerik:RangeSeries>
          <telerik:RangeSeries DisplayName="MaxValue" Stroke="#88FF0000" StrokeThickness="1" Fill="#44FF0000" ItemsSource="{Binding Data}" CategoryBinding="Timestmp" LowBinding="MaxValue" HighBinding="HighBinding"></telerik:RangeSeries>
</telerik:RadCartesianChart.Series>

Joachim
Top achievements
Rank 1
Iron
 answered on 18 Jun 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?