Hello!
I want to change DrageVisual Template in OnGiveFeedback event instead of set e.SetCursor(Cursors.Cross); Is it possible?
private void OnDragInitialize(object sender, DragInitializeEventArgs e)
{
e.DragVisual =new ContentControl { Name = "DragVisual", ContentTemplate =
this.AssociatedObject.Resources["DraggedItemTemplate"] as DataTemplate, DataContext = items.Count() };
e.DragVisualOffset = e.RelativeStartPoint;
e.AllowedEffects = DragDropEffects.All;
e.Handled = true;
}
}
private void OnGiveFeedback(object sender, Telerik.Windows.DragDrop.GiveFeedbackEventArgs e)
{
if (e.Effects == DragDropEffects.Move)
{
e.UseDefaultCursors = false;
e.SetCursor(Cursors.Arrow);
}
else if (e.Effects == DragDropEffects.None)
{
e.UseDefaultCursors = false;
e.SetCursor(Cursors.Cross);
}
else
{
e.UseDefaultCursors = true;
}
e.Handled = true;
}
How do I bind the DateTime Property (return value for GetDateTime())
of a class implementing ITimeIndicator to a Property of my ViewModel?
my thoughts:
<telerik:RadScheduleView.TimeIndicatorsCollection>
<telerik:TimeIndicatorsCollection>
<local:CustomTimeIndicator Location="WholeArea" Now="{Binding CurrentNow}" />
</telerik:TimeIndicatorsCollection>
</telerik:RadScheduleView.TimeIndicatorsCollection>public class CustomTimeIndicator : DependencyObject, ITimeIndicator
{
public static readonly DependencyProperty NowProperty = DependencyProperty.RegisterAttached("Now", typeof(DateTime), typeof(CustomTimeIndicator));
public DateTime Now
{
get => (DateTime)GetValue(NowProperty);
set => SetValue(NowProperty, value);
}
public DateTime GetDateTime()
{
return Now;
}
public TimeSpan Offset { get; set; }
public CurrentTimeIndicatorLocation Location { get; set; }
}Gives me:
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=CurrentNow; DataItem=null; target element is 'CustomTimeIndicator' (HashCode=47896050); target property is 'Now' (type 'DateTime')
Helloļ¼
About the RadDateTimePicker,
when I set the telerik:ValidationErrorTemplateHelper.ShowWhenFocused = "True"
It only doesn't work on Theme="Expression_Dark".
The others themes seems no problem.
Hi,
editor.TextFormatDefinitions.AddLast("Brace", new TextFormatDefinition(null, Brushes.Black));
...
MultilineTags.Add(new TagSpan<ClassificationTag>(tempSnapshotSpan, new ClassificationTag(new ClassificationType("Brace"))));Nothing special - RadSyntaxEditor and those two lines in WPF. Foreground is working very well - I can highlight any part of my text as I wish. But border and background does not working ... And also unwanted behavior - foreground of other highlighting is reset when I try highlight by background change... Even just border highlighting would be sufficient ... (I want highlight closest braces.)
Update:
Working brace content highlighter:
internal class ExpressionTagger : CSharpTagger
{
const string
openBraces = "([{",
closeBraces = ")]}";
new RadSyntaxEditor Editor => (RadSyntaxEditor)base.Editor;
public ExpressionTagger(RadSyntaxEditor editor) : base(editor)
{
editor.TextFormatDefinitions.AddLast("Class", new TextFormatDefinition(new SolidColorBrush(Color.FromRgb(43, 145, 175))));
editor.TextFormatDefinitions.AddLast("Brace", new TextFormatDefinition(new SolidColorBrush(Color.FromRgb(155, 83, 105))));
AddWord("Field", new ClassificationType("Class"));
AddWord("Custom", new ClassificationType("Class"));
AddWord("Triggers", new ClassificationType("Class"));
StringMatchingRegex = String.Empty; // NemĆ” smysl, neumĆ najĆt co chceme.
editor.CaretPosition.PositionChanged += CaretPosition_PositionChanged;
editor.KeyDown += CaretPosition_PositionChanged;
editor.KeyUp += CaretPosition_PositionChanged;
}
private void CaretPosition_PositionChanged(object sender, EventArgs e)
{
if (Editor.CaretPosition.Index < Document.CurrentSnapshot.Span.End)
{
char currentChar = Document.CurrentSnapshot.GetText(new Span(Editor.CaretPosition.Index, 1))[0];
if (MultilineTags.Any(tag => tag.Tag.ClassificationType.Name == "Brace") ||
(KeyboardModifiers.IsAltDown && (openBraces.Contains(currentChar) || closeBraces.Contains(currentChar))))
{
InvalidateMultilineTags();
}
}
}
protected override void RebuildMultilineTags()
{
base.RebuildMultilineTags();
string text = Editor.Document.CurrentSnapshot.GetText();
foreach (Match literal in Regex.Matches(text, "\"(?:[^\"]|\"{2})*\""))
{
TextSnapshotSpan tempSnapshotSpan = new TextSnapshotSpan(Document.CurrentSnapshot,
new Span(literal.Groups[0].Index, literal.Groups[0].Length));
MultilineTags.Add(new TagSpan<ClassificationTag>(tempSnapshotSpan, new ClassificationTag(ClassificationTypes.StringLiteral)));
}
if (KeyboardModifiers.IsAltDown)
{
int
startIndex = Editor.CaretPosition.Index,
searchIndex = 1,
closeIndex = 0;
char currentChar = Document.CurrentSnapshot.GetText(new Span(Editor.CaretPosition.Index, 1))[0];
int braceIndex = openBraces.IndexOf(currentChar);
if (braceIndex > -1)
{
char
openBrace = currentChar,
closeBrace = closeBraces[braceIndex];
closeIndex = startIndex + 1;
while (searchIndex > 0 && closeIndex < text.Length)
{
currentChar = text[closeIndex];
if (currentChar == openBrace)
{
searchIndex++;
}
if (currentChar == closeBrace)
{
searchIndex--;
}
closeIndex++;
}
closeIndex--;
currentChar = char.MinValue; // reset
}
braceIndex = closeBraces.IndexOf(currentChar);
if (braceIndex > -1)
{
char
openBrace = openBraces[braceIndex],
closeBrace = currentChar;
closeIndex = startIndex;
startIndex--;
while (searchIndex > 0 && startIndex > 0)
{
currentChar = text[startIndex];
if (currentChar == closeBrace)
{
searchIndex++;
}
if (currentChar == openBrace)
{
searchIndex--;
}
startIndex--;
}
startIndex++;
}
if (searchIndex == 0) // Found
{
TextSnapshotSpan tempSnapshotSpan = new TextSnapshotSpan(Document.CurrentSnapshot,
new Span(startIndex, closeIndex - startIndex + 1));
MultilineTags.Add(new TagSpan<ClassificationTag>(tempSnapshotSpan, new ClassificationTag(new ClassificationType("Brace"))));
}
}
}
}Hello,
in my Docking-Control, I want to highlight one specific RadPane at runtime (everywhere - un/pinned, floating, etc.).
I want only this RadPane to use different colors, than the others.
I was able to set the appreance for all of them, but not for a specific one.
How can I achieve the desired behaviour?
Hi,
We have an issue with a custom column we used in RadGridView.
There is a scenario when a column, hence a whole row is not selectable. Please see the attached sample solution and follow below scenario:
1. Scroll to Col5 which is editable,
2. Edit Col5 value
3. Click a column next to Col5 in the same row (to accept the value in Col5 cell),
4. Scroll to the left to see Id column
5. Select the row by clicking on Id cell In the same row.
The issue is that the row is not possible to be selected nor the checkbox in the column is ticked.
Can you advise?
Thanks,
Åukasz
Hi,
When you select a cell, the formula is shown in the formula text box. You click on a part of the formula to edit it at a certain spot and the cursor is positioned there but then instantly jumps to the end of the formula requiring you to click in the certain spot again.
This is very frustrating when you want to edit a formula.
This behavior can be seen in WPF demos.
Regards
Anthony

When the RadOutlookBar is in the minimized state, I want to trigger the content popup when a RadOutlookBarItem element is clicked, exactly as if MinimizedContentElement (a RadDropDownButton) had been clicked.
My imperfect solution adds a Click event to the RadOutlookBarItem element (which is not a button and only has MouseUp/MouseDown) with an attached property, and when this event is raised MinimizedContentElement.IsOpen is set to true which triggers the popup. (The RadOutlookBar.SelectionChanged event is not used because it is not raised if the item is already selected.)
The issue I have is that the popup stays open when there is a mouse click elsewhere in the window, even with MinimizedContentElement.KeepOpen=false and CloseOnPopupMouseLeftButtonUp=true. When the popup is triggered with a click on MinimizedContentElement, it closes automatically which is the behaviour I desire.
What's the simplest way to achieve this?
Thanks for any assistance you can provide.
I am getting a memory leak problem with Radrichtextbox. I continually create a rich text bus and print. this Radrichtextbox was added to the canvas container then its measured child size and arranged elements every time it went from this procedure it increased huge memory and never goes down, for example, creating 500 Radrichtextbox consumes more than 400 memory. I saw an increase when the parent container try to measure with the specific size and then arrange it and update the layout. I am unable to find which thing retains Radrichtextbox alive in memory. I attached some memory screenshots. i am using telerik version 2021. 1. 119. 45