Telerik Forums
UI for WPF Forum
2 answers
287 views

Hello,

I use the SyntaxEditor with the MS Roslyn compiler toolbox.

1) The location of the source of the compiler error (e.g., an unknown identifier) is defined by the first and last character positions of the identifier.

How to convert these positions into line number and character position in the SyntaxEditor?

 

2)  How to underline (e.g. in wavy red, like in Visual studio) temporarily, the source of the error, in the SyntaxEditor?

Thanks

Stephane

Stéphane
Top achievements
Rank 1
Iron
 answered on 14 Dec 2021
1 answer
89 views

I am trying to determine how to have the set number value start at the current line that is being highlighted in RadRichTextBox for WPF.

Here is an example, with steps to replicate:

1). Enter the following text(the word So. 6 times)(Do not add any spaces after each period):

2) Now put he 6 words containing So. into a numerical list:

3. Now highlight line number 4, like this(do not click your mouse and enter a space at any time):

4. Right click, and set numbering value to 74:

Final result:

Question, why is the numbering value starting at the next line(#5 in this case),  as opposed to the current line being underlined(#4)?

Is there a way to make the numbering value start at the current line(#4) with one extra space highlighted, with only selecting line #4 with the mouse(not clicking on it at all)? For example, following the exact same above steps but not selecting the extra space at the "." punctuation mark produces the following:

.

What is the reason for this highlighting of an extra space causing the numbering to start on the next line? Is a fix possible so that all characters highlighted on the current line and setting the numbering value will result in the number value changing at the current line, not the line after?

Thank you.

Tanya
Telerik team
 answered on 14 Dec 2021
0 answers
294 views

My app will typically work with 6 workbooks instantiated (one window each) simultaneously.
User will work interactively with the worksheets, just like he would if Excel was used.
After some editing, he/she will perform some heavy access of data (mostly reading), processing the data and send the outputs to another application (as xml documents by COM interface)

As a test I instantiate 6 spreadsheets, one window each and load them with the same xlsx file.
The loaded workbook filesize is about 430 kBytes and contains 37 worksheets (no graphs or other graphics, just plain worksheets) with a total of 45520 cells with data and 1489 formulas (according to Excel/Review/Workbook Statistics) .

My testmachine has an i7-8700 cpu (6 cores) and available memory before application start of about 24 GBytes of rwm.

The opening time until all 6 spreadsheets are visible and editable on screen is about 90 seconds and final working set is about 1.4 GBytes(!!).
Using Excel 2021/x64 and opening the same 6 workbook instances (6 different copies to enable single process) takes about 6 seconds with final working set of 237 MBytes.

The cpu load while editing the workbooks seems to be much more demanding than Excel as well, not really measured, probably acceptable.
Accessing cells data (reading plain cell data) seems to be doable with acceptable performance.

The long loading time and the high memory demand is not acceptable and means that I cannot use WPF radSpreadsheet as is and will need advice to lower these numbers if possible.
Alternatives are:
Using Excel (accessing with Excel COM automation), but I would very much like to avoid the license cost (and more complex application
development).

Finding another component supplier, similar to Telerik radSpreadsheet, but with possibly better performance (I guess it is not proper to ask in this forum for advice of which supplier could be recommended :)

EuroEager2008
Top achievements
Rank 1
 asked on 14 Dec 2021
2 answers
98 views

Hi there,

We have a situation where we're creating dockable panes and we'd like to make it so when you hit the button to make one it will create it and start a drag option automatically so you can then dock it where you want as soon as you make it, is this doable at all? I haven't been able to find anything online about it

Thanks

Stenly
Telerik team
 answered on 13 Dec 2021
1 answer
136 views

Hi,

I'm adding 2 column groups to my RadGridView, say "A" and "B".
Then I'm removing them using myRadGridView.RemoveRange().

Then I try to add them again: it works for "A", but raises an exception for "B": InvalidOperationException, because apparently a column group with this name already exists.
But I had removed "B" from the column groups!

So I tried to repro with a very simple case:

var cg = new GridViewColumnGroup { Name = "test" };
myRadGridView.ColumnGroups.Add(cg);
myRadGridView.ColumnGroups.Add(cg);

This is done right at the start of the app.
I exepect this to raise the same exception, since I'm trying to add several column groups with the same name.

But it executes without any problem!

So how does it work internally? At the moment this doesn't make much sense to me...

I'm wondering if this exception is only raised if the column groups are actually used by some columns, that are bound to data, but I can't tell...

Thanks for your feedback!

EDIT: I noticed the event RadGridView.ColumnGroups.CollectionChanging is only fired when using ColumnGroups.Add or .Remove, but not when using ColumnGroups.AddRange or ColumnGroups.RemoveRange. Could this be related to my issue?

EDIT2: I managed to avoid the exception by looping through my groupsToRemove and calling .Remove for each of them, instead of directly calling .RemoveRange. This is in the docs: WPF DataGrid | Column Groups | Telerik UI for WPF. However, I'm not using .SuspendNotifications() and .ResumeNotifications() around my loop. If I do this, the exception is raised again. Hope this helps!

Dilyan Traykov
Telerik team
 answered on 10 Dec 2021
1 answer
176 views

I had to add : 

foreach (var column in radgrid.Columns)
            {
                column.ColumnFilterDescriptor.FieldFilter.Clear();
            }

to clear the text .. 

question: is it supposed to work like that ? 

Martin Ivanov
Telerik team
 answered on 10 Dec 2021
0 answers
91 views

Hi Dear Telerik Developers
It seems there is a bug on exporting RadDocument to docx using DocxFormatProvider.  The problem is when the document has a rtl span. Not only the span which we want to be rtl dose not get right to left direction, but also some other properties of the span (such as bold and italic styles) get buggy and do not work properly on Microsoft Word. 

So, after a couple of hours working on this bug (decompiling  Telerik.Windows.Controls.RichTextBox.dll via JustDecompile and searching about what is going on inside of the component)  finally is turns out that the problem is in ExportTextDirection method of SpanExporter class under Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export namespace. This method uses "rtl" WML element which is not recognizes by Microsoft Word and should be "bidi" to perform correctly.
Thanks to OpenXML technology, currently I am using the following code as a trick to solve the problem:

private static void TestTelerik()
{
var document = new RadDocument();
var section = new Section();
document.Sections.Add(section);
var paragraph = new Paragraph();
paragraph.TextAlignment = Telerik.Windows.Documents.Layout.RadTextAlignment.Justify;
paragraph.FlowDirection = System.Windows.FlowDirection.RightToLeft;
var span = new Span();
span.FlowDirection = System.Windows.FlowDirection.RightToLeft;
span.Text = "متن فارسی نمومه";
span.FontWeight = System.Windows.FontWeights.Bold;
span.FontStyle = System.Windows.FontStyles.Italic;
span.FontFamily = new System.Windows.Media.FontFamily("Tahoma");
paragraph.Inlines.Add(span);
section.Blocks.Add(paragraph);
var provider = new DocxFormatProvider();
var bytes = provider.Export(document);
bytes = RefineDocx(bytes);
IO.File.Write("RTLSpanBugFix.docx", bytes);
}

private static byte[] RefineDocx(byte[] docx) 
{
var stream = new System.IO.MemoryStream(docx);
var openXml = DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open(stream, true);
var main = openXml.MainDocumentPart;
FixBugOnRightToLeft(main);
openXml.Save();
openXml.Close();
var result = stream.ToArray();
return result;
}
private static void FixBugOnRightToLeft(DocumentFormat.OpenXml.Packaging.MainDocumentPart main)
{
var outerXML = main.Document.OuterXml;
outerXML = outerXML.Replace("w:rtl w:val=", "w:bidi w:val=");
main.Document = new DocumentFormat.OpenXml.Wordprocessing.Document(outerXML);
}

 

Mohammad Afghari
Top achievements
Rank 2
 updated question on 09 Dec 2021
0 answers
247 views

Hi, 

we have a dataset of several thousand items which needs to be fully expanded if some search criteria is applied. This can be displayed with virtualization enabled but we encounter an issue where if we add new records the scroll position jumps to the top, this is not the case with virtualization disabled. 

we are using a hierarchical data template to display our tree view items , and would like the scroll position to remain somewhat consistently in the same place. 

Thanks, 

Richard 

 

 

 

 

 

Richard
Top achievements
Rank 1
 asked on 09 Dec 2021
2 answers
1.4K+ views
Hy i am can`t show image in a RadButton
Please told me how can i do this
Petar Mladenov
Telerik team
 answered on 09 Dec 2021
1 answer
169 views

I want to add a small arrow in the column header. This worked perfect. And if I click on this arrow, the column should have a ver small size (almost invisible).

So I have to set the column width almost to zero. Is there a way to set the width programmatically? I could only set the header width, but not the full column width.

 

This is my wpf to show the arrow:

                    <Style TargetType="telerik:ColumnHeaderContainer" BasedOn="{StaticResource ColumnHeaderContainerStyle}">
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Grid.Column="0" Text="{Binding Header}" />
                                        <Polygon Grid.Column="1" Points="7.5,5 11.5,2 11.5,8 7.5,5" Stroke="Black" StrokeThickness="1" VerticalAlignment="Bottom" 
                                                 HorizontalAlignment="Right" MouseDown="SpalteZusammenklappen">
                                            <Polygon.Style>
                                                <Style TargetType="Polygon">
                                                    <Style.Triggers>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter Property="Polygon.Fill">
                                                                <Setter.Value>
                                                                    <SolidColorBrush Color="Black"/>
                                                                </Setter.Value>
                                                            </Setter>
                                                        </Trigger>
                                                        <Trigger Property="IsMouseOver" Value="False">
                                                            <Setter Property="Polygon.Fill">
                                                                <Setter.Value>
                                                                    <SolidColorBrush Color="White"/>
                                                                </Setter.Value>
                                                            </Setter>
                                                        </Trigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Polygon.Style>
                                            <Polygon.RenderTransform>
                                                <RotateTransform Angle="-37" />
                                            </Polygon.RenderTransform>
                                        </Polygon>
                                    </Grid>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>

So my Header looks like this:

Stenly
Telerik team
 answered on 09 Dec 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?