Telerik Forums
UI for WPF Forum
1 answer
126 views

When a string field contains multiple lines, what is the correct text to put into the editor to match that multi-line field?

I've modified the Telerik sample, https://docs.telerik.com/devtools/wpf/controls/radexpressioneditor/getting-started, so that the Occupation for Sarah Blake contains a newline between Supplied and Manager. How does a user match the occupation? What is the correct escape sequence? Two double quotes, "", works for matching an embedded double quote, ",  but how does one match embedded newlines?

Martin Ivanov
Telerik team
 answered on 19 Dec 2024
4 answers
169 views

I have a RadGrid that is bound to a ObservableCollection<Customer>. Users can click the RadGrid rows and create an ExpressionColumn using ExpressionEditor. I set ExpressionEditor.Item like:

RadExpressionEditor expressionEditor = new RadExpressionEditor();
expressionEditor.Item = this.myRadGrid.SelectedItem;

 

Users can create an expression like 'Customer.BankBalance + 100' and it gets added to the RadGrid:

 

private GridViewExpressionColumn expressionColumn = new GridViewExpressionColumn();
 
this.expressionColumn.Expression = expressionEditor.Expression;
this.expressionColumn.Header = "Test";
if (!this.myRadGrid.Columns.Contains(this.expressionColumn))
{
     this.myRadGrid.Columns.Add(this.expressionColumn);
}

How can I now use the newly created "Test" expression column in another ExpressionColumn by repeating the process the user has just done? So they would select a row but the "Test" column is now available to use in the ExpressionEditor and they could do an expression like "Test + 100".

YBOT
Top achievements
Rank 1
Veteran
 answered on 14 Apr 2021
1 answer
135 views

Hi guys,

I want to make ExpressionEditor supports custom operators, and use those operators to replace existing one. For example, I want to use "!=" instead of "<>" for "not equal", and use "&&", "||" accordingly. I read the documentation and know how to customize the nodes in the tree, but how about features related to parsing? How to let the parser know the custom operators we defined?

PS: I'm using the latest WPF controls.

Ivan Petrov
Telerik team
 answered on 11 Jul 2019
1 answer
192 views

Hey,

currently I'm trying to implement the RadExpressionEditor for creating custom Grid view groups. Everything is working fine besides the ExpressionChanged event of the RadExpressionEditor. The event is not called every time the expression changed. If I enter the following expression:

"Sample: " + GetFormattedField("1282", "N2")

Expression changed is called.

if I remove the last bracket ExpressionChanged gets fired and the expression is invalid (this behaviour is correct). If I add the bracket again, ExpressionChanged IS NOT fired. This behaviour occurse in different scenarios. This makes it difficult to trust the system, because we have a lot of invalid expressions, even a valid expression is entered.

Thank you!

Ivan Petrov
Telerik team
 answered on 26 Jun 2019
3 answers
235 views

Dear all,

 

I'm using an expression editor bound against an object which is constructed via emit IL at runtime due to localizing the fields, we're using version 2014.3.1305.40.
A user now reports that he gets a null ref exception when changing an expression involving datetimes, the following stacktrace is available:
Top-level Exception
Type:        System.NullReferenceException
Message:     Object reference not set to an instance of an object
Source:      Telerik.Windows.Documents
Stack Trace:
   at Telerik.Windows.Documents.HierarchicalIndex.GetBoxByHierarchicalIndex(DocumentLayoutBox documentBox, HierarchicalIndex hierarchicalIndex) in c:\TB\534\Sources\Documents\Flow\Core\DocumentPosition\HierarchicalIndex.cs:line 131
   at Telerik.Windows.Documents.DocumentPosition.RestorePositionFromBoxIndex(Nullable`1 raiseEvent) in c:\TB\534\Sources\Documents\Flow\Core\DocumentPosition\DocumentPosition.cs:line 447
   at Telerik.Windows.Documents.Model.RadDocumentEditor.InsertTextInternal(String text, Span currentSpanStyle, Boolean explicitAcceptsReturn) in c:\TB\534\Sources\Documents\Flow\Core\Model\RadDocumentEditor_Editing.cs:line 2104
   at Telerik.Windows.Documents.Model.RadDocumentEditor.InsertFromUI(String text, Span currentSpanStyle, Boolean acceptsReturn) in c:\TB\534\Sources\Documents\Flow\Core\Model\RadDocumentEditor_Editing.cs:line 2072
   at Telerik.Windows.Controls.RadRichTextBox.Telerik.Windows.Documents.UI.ITextInputCommandsHandler.InsertText(String text) in c:\TB\534\Sources\Documents\Flow\Core\UI\RadRichTextBox.cs:line 7599
   at Telerik.Windows.Documents.UI.CaretTextInputHandler.InsertText(String text) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\CaretTextInputHandler.cs:line 344
   at Telerik.Windows.Documents.UI.CaretTextInputHandler.HandleTextInsertedWithoutIme(RadDocument document, String text) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\CaretTextInputHandler.cs:line 171
   at Telerik.Windows.Documents.UI.CaretTextInputHandler.CaretUI_TextInserted(Object sender, TextInsertedEventArgs e) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\CaretTextInputHandler.cs:line 90
   at Telerik.Windows.Documents.UI.Caret.OnTextInserted(Object sender, TextInsertedEventArgs e) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\Caret_Common.cs:line 278
   at Telerik.Windows.Documents.UI.Caret.Timer_Tick(Object sender, EventArgs e) in c:\TB\534\Sources\Documents\Flow\Core\UI\Caret\Caret_Common.cs:line 259
   at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Could you please provide some insights? I'm not able to reproduce the problem on my machine (only once) and fear that it might be a "race condition" involving events in the UI. What I can tell is that it happens when adjusting the date and time part of the expression according to the user, I've seen it multiple times live on screen and was able to invoke it once on my machine. The steps he did were these, he always positions the cursor by using the mouse after the value to change and uses backspace to remove the number and then types the new number, eg position after first 1 in 11, remove the first 1 by using backspace and then typing 0:

Expression at start, via binding:
(Fromdate >= #11/05/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #1/05/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #01/05/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #01/0/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #01/04/2016 06:00:00# And Todate <= #12/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #01/04/2016 6:00:00# And Todate <= #12/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #01/05/2016 16:00:00# And Todate <= #12/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #01/05/2016 06:00:00# And Todate <= #2/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #01/05/2016 06:00:00# And Todate <= #02/05/2016 06:00:00#)

Intermediate:
(Fromdate >= #01/05/2016 06:00:00# And Todate <= #02/0/2016 06:00:00#)

Changing May to April invokes the exception when typing the 4:
(Fromdate >= #01/05/2016 06:00:00# And Todate <= #12/04/2016 06:00:00#)

 

Hope you can help me out with this one since it's bugging the user for quite some time now.

 

Kind regards,
Dwight

Dilyan Traykov
Telerik team
 answered on 25 Mar 2019
4 answers
314 views
Hello,

we're using your RadExpression editor in our application. We create the expressions using the editor and then we save them. At a
later stage we parse them using the editor again, but we would like to use the parsing functionality without a dependence on WPF.
Is there anyway to do that with any of your products?


public static List<T> Filter<T>(IList<T> items, string filter) where T : new()
        {
            var result = new List<T>();
 
            try
            {
                var editor = new RadExpressionEditor();
                editor.Item = new T();
                Expression exprResult;
                var isSuccess = editor.TryParse(filter, out exprResult);
 
                if (isSuccess)
                {
                    var expr1 = (Expression<Func<T, bool>>)exprResult;
                    var func = expr1.Compile();
                    result = items.Where(func).ToList();
                }
            }
            catch (Exception)
            {
                
            }
 
            return result;
        }
regards,
Ned Stoyanov
Maurizio
Top achievements
Rank 2
 answered on 05 Mar 2019
6 answers
198 views
A company that I consult for has an application that uses the expression editor.  A configuration box that uses the expression editor has a calculation that used to work but no longer does.  It appears that the Round function has changed to not allow parenthesis within it's own.  Can someone explain if there has been a recent change in R1 2019 that might explain this?
Ivan Petrov
Telerik team
 answered on 06 Feb 2019
5 answers
201 views

Hi,

1) setting ExpressionEditor.Item = DataRow, the control show correct fields (Names and Types) but it is not working (the result preview is allway empty)

2) Is possible to force a result type? In example, I want a boolean expression.

3) String Functions appears in documentation images but not in real control, why?

Thanks,

marc.

Dilyan Traykov
Telerik team
 answered on 20 Dec 2017
1 answer
175 views

hello,

why I input Sin(100.5),the ExpressionEditor could not show the result?

 

Wang
Top achievements
Rank 1
 answered on 16 Aug 2017
1 answer
159 views

hello!

I use ExpressionEditor in a project ,the main code is: 

xaml:

 <TextBox x:Name="aaa"/>
<telerik:RadExpressionEditor Grid.Row="1" x:Name="ExpressionEditor"
ExpressionChanged="ExpressionEditor_ExpressionChanged"
ExpressionText="Sin(100)" />

 

cs:

private void ExpressionEditor_ExpressionChanged(object sender, RadRoutedEventArgs e)
        {
            try
            {
                dynamic dynamicExpression = ExpressionEditor.Expression;
                dynamic compiledExpression = dynamicExpression.Compile();
                object executionResult = compiledExpression();
                aaa.Text = executionResult.ToString();
            }
            catch
            {

            }
            
        }

 

the TextBox can show the result,but result preview of the RadExpressionEditor did not show the result,why? what should I do?

by the way,can we improve the RadExpressionEditor to make the programmer can  add custorm function or constants like Pi?

Wang
Top achievements
Rank 1
 answered on 09 Aug 2017
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
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
InlineAIAssistant
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?