Telerik Forums
UI for WPF Forum
1 answer
176 views

Hi,

In our project we have a document editor that borrows from the code of the telerik editor found here: https://github.com/telerik/xaml-sdk/blob/master/RichTextBox/TelerikEditor/TelerikEditor.xaml. After the release allowing shapes to be added we have been receiving requests to add the ability for the use to input shapes using the our editor in the same way it is shown here: https://docs.telerik.com/devtools/wpf/controls/radrichtextbox/features/shapes/shapes. After a lot of searching through forums and the documentation on shapes I have found no way to implement this feature. Could someone advise me on how to add the shapes dropdown to the ribbon of the editor, and whether or not that is all the code I will need to allow a user to add/manipulate the predefined shapes? The documentation says that "In the Insert tab, you will find a list containing various predefined shapes you can choose between". I haven't found a way to add this to our editor or even where it resides in the telerik editor. Any help would be greatly appreciated.

Dimitar
Telerik team
 answered on 08 Apr 2022
1 answer
367 views

Hi,

I have created a gridview with a rowdetail that uses the rowdetailstemplateselector to show a different row depending on an itemsource property. I would like to control rowdetailsvisibiltiy based on a property of the item. Is there an example for this and or could you point me to what event I would need to use to control the the rowdetailsvisiblity on a per row basis?

Thanks

Rob

Martin Ivanov
Telerik team
 answered on 08 Apr 2022
1 answer
110 views

Tried extending the a custom tooltip tagger to recognize multiple words/tooltips but no luck. Below is my custom tooltip tagger, any thoughts on where I am going wrong?


using System.Collections.Generic;
using Telerik.Windows.SyntaxEditor.Core.Editor;
using Telerik.Windows.SyntaxEditor.Core.Tagging;
using Telerik.Windows.SyntaxEditor.Core.Text;

namespace QuickMeasuresPro
{
    class DAXTooltipTagger : TaggerBase<ToolTipTag>
    {
        private string searchWord;

        private static readonly string[] Keywords = new string[]
        {
            "APPROXIMATEDISTINCTCOUNT","AVERAGE","AVERAGEA","AVERAGEX"
        };

        private static readonly string[] Tooltips = new string[]
        {
            "APPROXIMATEDISTINCTCOUNT(<columnName>)\r\nReturns the approximate number of rows that contain distinct values in a column.",
            "AVERAGE(<column>)\r\nReturns the average (arithmetic mean) of all the numbers in a column.",
            "AVERAGEA(<column>)\r\nReturns the average (arithmetic mean) of the values in a column.",
            "AVERAGEX(<table>,<expression>)\r\nCalculates the average (arithmetic mean) of a set of expressions evaluated over a table.",
        };

        public DAXTooltipTagger(ITextDocumentEditor editor)
            : base(editor)
        {
        }

        public override IEnumerable<TagSpan<ToolTipTag>> GetTags(NormalizedSnapshotSpanCollection spans)
        {
            if (string.IsNullOrEmpty(this.searchWord))
            {
                yield break;
            }

            TextSnapshot snapshot = this.Document.CurrentSnapshot;
            foreach (TextSnapshotSpan snapshotSpan in spans)
            {
                string lineString = snapshotSpan.GetText();
                int i = 0;
                foreach (string keyword in Keywords)
                {
                    string tooltip = Tooltips[i];
                    i++;
                    int index = lineString.IndexOf(keyword);
                    while (index != -1)
                    {
                        TextSnapshotSpan tempSnapshotSpan = new TextSnapshotSpan(snapshot,
                            new Span(snapshotSpan.Start + index, keyword.Length));

                        yield return new TagSpan<ToolTipTag>(tempSnapshotSpan, new ToolTipTag(tooltip));

                        index = lineString.IndexOf(keyword, index + keyword.Length);
                    }
                }
            }
        }

        public void UpdateSearchWord(string newSearchWord)
        {
            this.searchWord = newSearchWord;
            this.CallOnTagsChanged(this.Document.CurrentSnapshot.Span);
        }
    }
}

Petar Mladenov
Telerik team
 answered on 08 Apr 2022
1 answer
168 views

Implementing a custom tagger for SyntaxEditor control for DAX code and want to implement the MultilineTags for comments /* */.

Below is my custom tagger, how would I implement MultilineTags for this?


    public class DAXTagger : WordTaggerBase    
    {
        private static readonly string[] Keywords = new string[]
        {
            "APPROXIMATEDISTINCTCOUNT","AVERAGE","AVERAGEA","AVERAGEX","COUNT","COUNTA","COUNTAX","COUNTBLANK","COUNTROWS",
            "COUNTX","DISTINCTCOUNT","DISTINCTCOUNTNOBLANK","MAX","MAXA","MAXX","MIN","MINA","MINX","PRODUCT","PRODUCTX","SUM","SUMX",
            "CALENDAR","CALENDARAUTO","DATE","DATEDIFF","DATEVALUE","DAY","EDATE","EOMONTH","HOUR","MINUTE","MONTH","NOW","QUARTER",
            "SECOND","TIME","TIMEVALUE","TODAY","UTCNOW","UTCTODAY","WEEKDAY","WEEKNUM","YEAR","YEARFRAC",
            "ALL","ALLCROSSFILTERED","ALLEXCEPT","ALLNOBLANKROW","ALLSELECTED","CALCULATE","CALCULATETABLE","EARLIER","EARLIEST",
            "FILTER","KEEPFILTERS","LOOKUPVALUE","REMOVEFILTERS","SELECTEDVALUE","ACCRINT","ACCRINTM","AMORDEGRC","AMORLINC","COUPDAYBS",
            "COUPDAYS","COUPDAYSNC","COUPNCD","COUPNUM","COUPPCD","CUMIPMT","CUMPRINC","DB","DDB","DISC","DOLLARDE","DOLLARFR",
            "DURATION","EFFECT","FV","INTRATE","IPMT","ISPMT","MDURATION","NOMINAL","NPER","ODDFPRICE","ODDFYIELD","ODDLPRICE",
            "ODDLYIELD","PDURATION","PMT","PPMT","PRICE","PRICEDISC","PRICEMAT","PV","RATE","RECEIVED","RRI","SLN","SYD","TBILLEQ",
            "TBILLPRICE","TBILLYIELD","VDB","XIRR","XNPV","YIELD","YIELDDISC","YIELDMAT","CONTAINS","CONTAINSROW","CONTAINSSTRING",
            "CONTAINSSTRINGEXACT","CUSTOMDATA","HASONEFILTER","HASONEVALUE","ISAFTER","ISBLANK","ISCROSSFILTERED","ISEMPTY","ISERROR",
            "ISEVEN","ISFILTERED","ISINSCOPE","ISLOGICAL","ISNONTEXT","ISNUMBER","ISODD","ISONORAFTER","ISSELECTEDMEASURE","ISSUBTOTAL",
            "ISTEXT","NONVISUAL","SELECTEDMEASURE","SELECTEDMEASUREFORMATSTRING","SELECTEDMEASURENAME","USERNAME","USEROBJECTID",
            "USERPRINCIPALNAME","AND","BITAND","BITLSHIFT","BITOR","BITRSHIFT","BITXOR","COALESCE","FALSE","IF","IF.EAGER","IFERROR",
            "NOT","OR","SWITCH","TRUE","ABS","ACOS","ACOSH","ACOT","ACOTH","ASIN","ASINH","ATAN","ATANH","CEILING","CONVERT","COS",
            "COSH","COT","COTH","DEGREES","DIVIDE","EVEN","EXP","FACT","FLOOR","GCD","INT","ISO.CEILING","LCM","LN","LOG",
            "LOG10","MROUND","ODD","PI","POWER","QUOTIENT","RADIANS","RAND","RANDBETWEEN","ROUND","ROUNDDOWN","ROUNDUP","SIGN","SIN",
            "SINH","SQRT","SQRTPI","TAN","TANH","TRUNC","BLANK","ERROR","PATH","PATHCONTAINS","PATHITEM","PATHITEMREVERSE","PATHLENGTH",
            "CROSSFILTER","RELATED","RELATEDTABLE","USERELATIONSHIP","BETA.DIST","BETA.INV","CHISQ.DIST","CHISQ.DIST.RT","CHISQ.INV",
            "CHISQ.INV.RT","COMBIN","COMBINA","CONFIDENCE.NORM","CONFIDENCE.T","EXPON.DIST","GEOMEAN","GEOMEANX","MEDIAN","MEDIANX",
            "NORM.DIST","NORM.INV","NORM.S.DIST","NORM.S.INV","PERCENTILE.EXC","PERCENTILE.INC","PERCENTILEX.EXC","PERCENTILEX.INC",
            "PERMUT","POISSON.DIST","RANK.EQ","RANKX","SAMPLE","STDEV.P","STDEV.S","STDEVX.P","STDEVX.S","T.DIST","T.DIST.2T",
            "T.DIST.RT","T.INV","T.INV.2t","VAR.P","VAR.S","VARX.P","VARX.S","ADDCOLUMNS","ADDMISSINGITEMS","CROSSJOIN","CURRENTGROUP",
            "DETAILROWS","DISTINCT column","DISTINCT table","EXCEPT","FILTERS","GENERATE","GENERATEALL","GENERATESERIES",
            "GROUPBY","IGNORE","INTERSECT","NATURALINNERJOIN","NATURALLEFTOUTERJOIN","ROLLUP","ROLLUPADDISSUBTOTAL","ROLLUPISSUBTOTAL",
            "ROLLUPGROUP","ROW","SELECTCOLUMNS","SUBSTITUTEWITHINDEX","SUMMARIZE","SUMMARIZECOLUMNS","Table Constructor","TOPN",
            "TREATAS","UNION","VALUES","COMBINEVALUES","CONCATENATE","CONCATENATEX","EXACT","FIND","FIXED","FORMAT","LEFT","LEN",
            "LOWER","MID","REPLACE","REPT","RIGHT","SEARCH","SUBSTITUTE","TRIM","UNICHAR","UNICODE","UPPER","VALUE",
            "CLOSINGBALANCEMONTH","CLOSINGBALANCEQUARTER","CLOSINGBALANCEYEAR","DATEADD","DATESBETWEEN","DATESINPERIOD","DATESMTD",
            "DATESQTD","DATESYTD","ENDOFMONTH","ENDOFQUARTER","ENDOFYEAR","FIRSTDATE","FIRSTNONBLANK","LASTDATE","LASTNONBLANK",
            "NEXTDAY","NEXTMONTH","NEXTQUARTER","NEXTYEAR","OPENINGBALANCEMONTH","OPENINGBALANCEQUARTER","OPENINGBALANCEYEAR",
            "PARALLELPERIOD","PREVIOUSDAY","PREVIOUSMONTH","PREVIOUSQUARTER","PREVIOUSYEAR","SAMEPERIODLASTYEAR","STARTOFMONTH",
            "STARTOFQUARTER","STARTOFYEAR","TOTALMTD","TOTALQTD","TOTALYTD",
            "BOOLEAN","CURRENCY","DATETIME","DOUBLE","INTEGER","STRING"
        };

        private static readonly string[] Comments = new string[]
        {
        "//", "--", "/*", "*/"
        };

        private static readonly string[] Operators = new string[]
        {
        "+", "-",  "*", "/", "^", "&", "|", "&&", "||"
        };

        public static readonly ClassificationType Keywords1ClassificationType = new ClassificationType("Keywords1");

        private static readonly string[] Keywords1 = new string[]
        {
        "VAR", "RETURN", "DATATABLE"
        };

        private static readonly Dictionary<string, ClassificationType> WordsToClassificationType = new Dictionary<string, ClassificationType>();

        static DAXTagger()
        {
            WordsToClassificationType = new Dictionary<string, ClassificationType>();

            foreach (var keyword in Keywords)
            {
                WordsToClassificationType.Add(keyword, ClassificationTypes.Keyword);
            }

            foreach (var preprocessor in Operators)
            {
                WordsToClassificationType.Add(preprocessor, ClassificationTypes.Operator);
            }

            foreach (var comment in Comments)
            {
                WordsToClassificationType.Add(comment, ClassificationTypes.Comment);
            }

            foreach (var comment in Keywords1)
            {
                WordsToClassificationType.Add(comment, Keywords1ClassificationType);
            }
        }

        public DAXTagger(Telerik.Windows.Controls.RadSyntaxEditor editor)
          : base(editor)
        {
        }

        protected override Dictionary<string, ClassificationType> GetWordsToClassificationTypes()
        {
            return DAXTagger.WordsToClassificationType;
        }

        protected override bool TryGetClassificationType(string word, out ClassificationType classificationType)
        {
            int number;

            if (int.TryParse(word, out number))
            {
                classificationType = ClassificationTypes.NumberLiteral;
                return true;
            }

            return base.TryGetClassificationType(word, out classificationType);
        }

        protected override IList<string> SplitIntoWords(string value)
        {
            List<string> words = new List<string>();
            string word;
            int lastCharType = -1;
            int startIndex = 0;

            for (int i = 0; i < value.Length; i++)
            {
                int charType = GetCharType(value[i]);
                if (charType != lastCharType)
                {
                    word = value.Substring(startIndex, i - startIndex);
                    words.Add(word);
                    startIndex = i;
                    lastCharType = charType;
                }
                else if (value[i] == '#' && value[i - 1] == '#')
                {
                    word = value.Substring(startIndex, i - startIndex);
                    words.Add(word);
                    startIndex = i;
                    lastCharType = charType;
                }
            }

            word = value.Substring(startIndex, value.Length - startIndex);
            words.Add(word);

            return words;
        }

        internal static int GetCharType(char c)
        {
            if (c == '#' || c == '_')
            {
                return 3;
            }

            if (char.IsWhiteSpace(c))
            {
                return 1;
            }

            if (char.IsPunctuation(c) || char.IsSymbol(c))
            {
                return 2;
            }

            return 0;
        }
    }
}

Petar Mladenov
Telerik team
 answered on 08 Apr 2022
0 answers
168 views

I was using  telerik controls with version 2020.2.617.45 and everything works fine, but when I updated Telerik.Windows.Data, Telerik.Windows.Controls and Telerik.Windows.controls.Data  dll`s to version 2022.1.222.45 I got error in my custom behaviour at this row:

private void AssociatedObject_GotFocus(object sender, RoutedEventArgs e)
        {
            RadGridView gridView = sender as RadGridView;

            if (gridView != null && gridView.CurrentCell != null && !gridView.CurrentCell.IsInEditMode && !gridView.CurrentCell.Column.IsReadOnly)
                gridView.CurrentCell.BeginEdit();
        }

when I call gridView.CurrentCell.BeginEdit(); and I got error :System.MissingFieldException: 'Field not found: 'Telerik.Windows.Controls.ThemeManager.DefaultThemeName'.'

The problem occured after update.

Vivian
Top achievements
Rank 1
 asked on 06 Apr 2022
1 answer
167 views
I've got a RadSplitButton.  I want the dropdown's content frame to be aligned on the left, along with the left edge of the main button .  On my machine it is like this (see the first attachment, "splitbuttongood.jpg"). 

But on my colleague's machine, the dropdown content frame is aligned to the right, along with the button that makes it appear. (see the second attachment, "splitbuttonbad.jpg")>


Is there a property I can set to control this?  Do I have to retemplate the entire control?

I should add, this exactly the same code in both cases that's producing this different effect on the two machines
Stenly
Telerik team
 answered on 04 Apr 2022
1 answer
167 views

I am inserting text in Richtextbox control from word document. Richtextbox load document correctly and formatting is valid as per MS word document. 

Then save document as html and reopen document in Richtextbox. I noticed that Table content is overflowed in paged layout i.e. Columns are clipped or not showing in document area. And also print incomplete document. As I stated when load document, formatting is correct, but exporting document to html and reloading html generated document, this issue happened.

Moreover there is some formatting issue as I highlighted in attached sample image.

This issue can be reproduced in Telerik UI for WPF demos. Following steps to reproduce issue.

  1. In Richtextbox open or paste content from attached sampleDocument.docx document. Document is loaded, and formatting is valid.
  2. Save as html. sample html output is attached for reference
  3. Open saved html document in Richtextbox. You will notice Table formatting/ alignment is not as per actual document.

I am using Telerik UI for WPF R1 2022

 

 

Svilen
Telerik team
 answered on 04 Apr 2022
0 answers
293 views

Hello,

 

i'm currently working with some hierarchical data that i wanted to present using a RadGridView with its ChildTable feature.

 

Unfortunately i'm running in quite severe performance issues once i try to auto expand the child tables (waiting between 15 to 25 seconds to see my data).

I've read that placing the RadGridView in a container with infinite height (like ScrollViewer, Grid with height 'Auto', etc) could lead to such performance issues, but i didn't place it in such containers.

 

I prepared and attached a little demo project to reproduce my problem.

 

It would be great if someone got some tips for me on how to improve the performance when expanding multiple levels of hierarchies in a RadGridView.

 

Greetings,

Josh

 

Joshua
Top achievements
Rank 1
 asked on 04 Apr 2022
3 answers
197 views

Hi,

 

We wish to auto open the settings pane whenever the user selects a particular shape. What is the standard way of achieving this?

We have added a event handler for the selection changed event, just need the method to trigger the settings pane open.

Thank you.

Petar Mladenov
Telerik team
 answered on 04 Apr 2022
1 answer
191 views

Hi

I have a checkbox as a cell in one of my gridviews. if you double click it, the chech box  will hides.

how can I disable double click , to prevent hiding the checkbox?

I tried:

setting e.handled to true  in "PreviewMouseDoubleClick" but did not work(still hides)

 



<telerik:GridViewDataColumn>

<telerik:GridViewColumn.CellTemplate>

<DataTemplate>
<CheckBox>
#close tags#

 

Martin Ivanov
Telerik team
 answered on 04 Apr 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?