Telerik Forums
UI for WPF Forum
1 answer
188 views
Hi, 
Using Telerik.UI.for.Wpf.NetCore.Xaml  (2022.3.912).
I'm getting an error for the taskboard the first time it loads
Both 'ContentTemplate' and 'ContentTemplateSelector' are set;  'ContentTemplateSelector' will be ignored. RadTaskBoardItem:'RadTaskBoardItem' (Name='')
this error as many as the Item task that appears.

Then when I exit and return to the taskboar page, another error appears:
Cannot find source: RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.RadTaskBoard', AncestorLevel='1'

        <telerik:RadTaskBoard x:Name="RadTaskBoard01"  Grid.Row="3" 
                              ItemsSource="{Binding TaskboardCollView}" 
                              GroupMemberPath="State"
                              Background="{StaticResource StripeColor}" 
                              AutoGenerateColumns="False">
            <telerik:RadTaskBoard.DragDropBehavior>
                <localservice:CustomTaskBoardDragDropBehavior/>
            </telerik:RadTaskBoard.DragDropBehavior>
            <telerik:RadTaskBoard.Columns>
                <telerik:TaskBoardColumn GroupName="NEW" Header="Red"  />
                <telerik:TaskBoardColumn GroupName="INPROGRESS" Header="Yellow" />
                <telerik:TaskBoardColumn GroupName="REVIEWED" Header="Gray" />
                <telerik:TaskBoardColumn GroupName="DONE" Header="ForestGreen" />
            </telerik:RadTaskBoard.Columns>
            <telerik:RadTaskBoard.ColumnHeaderTemplate >
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions >
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Border  Width="17" Grid.Column="0" Background ="{Binding Header}"  BorderThickness="1" BorderBrush="Black" CornerRadius="10" ></Border>
                        <TextBlock Grid.Column="1" Text="{Binding GroupName}"  HorizontalAlignment="Left"  />
                        <TextBlock Grid.Column="2" Margin="10 ,0 ,10, 0" Text="{Binding Items.Count}" HorizontalAlignment="Right" />
                    </Grid>
                </DataTemplate>
            </telerik:RadTaskBoard.ColumnHeaderTemplate>
            <telerik:RadTaskBoard.ItemTemplate>
                <DataTemplate>
                    <Grid >
                        <Grid.ColumnDefinitions >
                            <ColumnDefinition Width="5"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions >
                            <RowDefinition/>
                            <RowDefinition Height="25"/>
                        </Grid.RowDefinitions>
                        <Grid Grid.Row="0" Grid.RowSpan="2" Grid.Column ="0" 
                              Background="{Binding CategoryName, Converter={StaticResource CategoryToColour}}">
                        </Grid>
                        <StackPanel  Grid.Row="0"  Grid.Column ="1" >
                            <TextBlock Text="{Binding Parenttitle}"  Margin="15,0,5,0"   Foreground="{StaticResource StripeColor}"  FontSize="16" TextWrapping="Wrap"  />
                            <StackPanel Visibility="{Binding Isparent, Converter={StaticResource BoolToVisible}}">
                                <TextBlock Text="Have Sub Task"
                                           HorizontalAlignment="Right"
                                           Margin="0,0,5,0"
                                           Foreground="Red"
                                           FontWeight="Bold"
                                           FontStyle ="Italic" 
                                           FontSize="12" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding Title, Converter={StaticResource EmptyToVisible }}">
                                <TextBlock Text="{Binding Title}"
                                           Margin="15,0,5,0"
                                           Foreground="Brown"
                                           TextWrapping="WrapWithOverflow"
                                           FontSize="14" />
                            </StackPanel>
                            <TextBlock Text="{Binding Description}"
                                       Margin="15,0,5,0"
                                       TextWrapping="Wrap"
                                       FontSize="14" />
                        </StackPanel>

                        <TextBlock Text="{Binding Assignee}"  Grid.Row="1"   Grid.Column ="1" Margin="15,0,15,0" Foreground="ForestGreen"      
                                   FontSize="16" FontStyle="Italic"  HorizontalAlignment="Right" VerticalAlignment="Bottom" />
                    </Grid>
                </DataTemplate>
            </telerik:RadTaskBoard.ItemTemplate>
        </telerik:RadTaskBoard>

Stenly
Telerik team
 answered on 13 Dec 2022
1 answer
187 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
165 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
177 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
222 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
190 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
170 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
278 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
204 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
196 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
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
ExpressionEditor
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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?