Telerik Forums
UI for WPF Forum
1 answer
130 views

Hello!
I want to change DrageVisual Template in OnGiveFeedback event instead of set e.SetCursor(Cursors.Cross); Is it possible?

I am setting DragVisual like this
        

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; } }


And then set cursor type in this method
        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;
        }
Martin Ivanov
Telerik team
 answered on 12 Dec 2022
2 answers
130 views

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')

 

Martin
Top achievements
Rank 1
Iron
 answered on 09 Dec 2022
1 answer
126 views

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.

Masha
Telerik team
 answered on 08 Dec 2022
0 answers
187 views

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"))));
            }
        }
    }
}
Just it is ugly, because I am able only to change Foreground. How can I at least use Find border boxes or any better highlight option?
Matt
Top achievements
Rank 1
 updated question on 08 Dec 2022
0 answers
136 views
We have implemented custom timeline intervals for radtimeline which was working fine with earlier version of Telerik framework(2019) but after the upgrade to latest(R3 2022 SP1) Telerik framework, with custom intervals the timeline is not loading when customization is removed it works fine(default timeline intervals).

Is there any change with new framework we should be considering?

We are currently testing out the Telerik Upgrade with Demo version of the framework(R3 2022 SP1). Could this be an issue?
Shivam
Top achievements
Rank 1
Iron
 asked on 07 Dec 2022
0 answers
121 views

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?

Melanie
Top achievements
Rank 1
 asked on 06 Dec 2022
0 answers
206 views

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

Licensing
Top achievements
Rank 1
 asked on 06 Dec 2022
1 answer
121 views

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

Dimitar
Telerik team
 answered on 06 Dec 2022
1 answer
145 views

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.

Dilyan Traykov
Telerik team
 answered on 06 Dec 2022
5 answers
340 views

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

junaid
Top achievements
Rank 1
Iron
 answered on 06 Dec 2022
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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
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
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?