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?
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".
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.
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!
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
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,
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.
hello,
why I input Sin(100.5),the ExpressionEditor could not show the result?
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?