WPF, RadContextMenu
Is there a way to display different colors in the RadContextMenu ?
Display RadContextMenu various colors based on the Separator of RadContextMenu.
In RadContextMenu,
Also, can you set the image margin(or icon margin) to 0?
Please check the attached file : RadContextMenu2WPF.png, RadContextMenu1WPF.png
Hi Team,
We have developer license for the Telerik UI for WPF product, however we are unable to get the developer MSI for the Telerik UI for WPF 2024.1.130.45. Only the trial version is visible now.
Could you please guide us to get the dev version of 2024.1.130.45?
Hello Telerik Team,
I'm working with the RadDiagram control and have a scenario where I need certain RadDiagramShapes to display their AdditionalContent persistently – meaning the content should remain visible even when the shape is not selected. Additionally, I want to achieve this behavior and customize the AdditionalContent's styling purely through MVVM binding approaches.
Could you please provide guidance or code examples demonstrating:
Any suggestions for binding strategies or relevant Shape/Style properties would be greatly appreciated. Thank you!
Hi,
I tried to combine the 2 telerik examples related to RadTreeviews - the RadTreeView as File Explorer and that from SDK repo related to drag and drop between 2 Radtreeview.
I finally succeeded to make an working short program, but I don't know why by dragging a file from one tree to another, the UI of the second tree shows the dropped file twice - even the Tree ItemsSource is correct (only one file dragged and dropped)
after Puplating the trees,I used DragDropMAnager and the following classes (as they are defined in telerik example, adapted to files/folder structure)
DragDropManager.AddDragOverHandler(this.tree1, OnTree1DragOver, true);
DragDropManager.AddDragOverHandler(this.tree2, OnTree2DragOver, true);
DragDropManager.AddDropHandler(this.tree2, OnTree2Drop, true);
My OnTree2DragOver function:
var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
if (options == null)
return;
// The condition after the first OR operator is needed to deny the drop of items in Application File. (sub-items)
RadTreeViewItem dropTargetItem = options.DropTargetItem;
var draggedItem = options.DraggedItems.First();
if (dropTargetItem == null ||
(dropTargetItem != null &&
options.DropTargetItem.DataContext is File &&
options.DropPosition == DropPosition.Inside) ||
draggedItem is Folder)
{
options.DropAction = DropAction.None;
}
options.UpdateDragVisual();
my OnTree2Drop function is:
var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
if (options == null)
return;
File draggedItem = options.DraggedItems.FirstOrDefault() as File;
if (draggedItem == null)
return;
RadTreeViewItem dropTargetItem = options.DropTargetItem;
if (dropTargetItem == null)
return;
var dropItemModel = dropTargetItem.DataContext;
if (dropItemModel == null)
return;
var dropTree = sender as RadTreeView;
if (dropTree != null)
{
// Disable drop in tree2 File.
if (dropItemModel is File && options.DropAction == DropAction.None)
{
e.Handled = true;
return;
}
//Drop in tree2
if (dropItemModel is Folder || dropItemModel is File)
{
options.DropAction = DropAction.Copy;
//options.UpdateDragVisual();
Folder destinationFolder = null;
if (dropItemModel is Folder)
{
// Dropping inside Application.
destinationFolder = dropItemModel as Folder;
}
else
{
// Dropping Before or After an Application Resource.
destinationFolder = options.DropTargetItem.ParentItem.DataContext as Folder;
}
if (destinationFolder == null)
{
return;
}
File file = new File()
{
Name = draggedItem.Name
};
destinationFolder.Items.Add(file);
//options.UpdateDragVisual();
System.IO.File.Copy(@draggedItem.FullPath, System.IO.Path.Combine(@destinationFolder.FullPath, System.IO.Path.GetFileName(@draggedItem.FullPath)));
options.UpdateDragVisual();
My OnTree1DragOver:
var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
if (options != null)
{
options.DropAction = DropAction.None;
options.UpdateDragVisual();
var draggedFile = options.DraggedItems.First() as File;
e.Handled = true;
}
In the attached picture you'll see Adeliatte Italic.ttf twice, even I dragged and drpped it only once.
Could you please take a short look and tell me what I'm doing wrong?
Or, if it is not too much time consuming for you to come back with an example of 2 treeviews acting as explorer and with d&d functionality?
Thank you in advance for your support.
Danny
<telerik:RadBusyIndicator x:Name="radBusyIndicator"
Foreground="#ffffff"
IsBusy="{Binding IsBusy}">
I use the above when to show the busy indicator while saving.
After it has saved (IsBusy is false) I call Element.Focus(); but it does not focus on the element.
No element shows as being focused.
If I remove the line that sets IsBusy to true the focus works as expected.
Is there a workaround for this problem?
This should be trivial, but.... I see an old question about this at HorizontalContentAlignment doesn't work in UI for WPF | Telerik Forums. When I download the sample, it works as advertised, even if I upgrade to the latest. However, in my project I can't seem to get the text to right-justify. This is a direct copy of my XAML:
<telerik:RadNumericUpDown Grid.Row="9" Grid.Column="1" Width="100" NumberDecimalDigits="0" Value="{Binding MyIntField}" HorizontalContentAlignment="Right" />
And yet...
If I inspect the field in the live tree, "HorizontalContentAlignment" shows "Right".
What have I got wrong?
When reading https://docs.telerik.com/devtools/wpf/controls/radgridview/hierarchical-gridview/self-referencing-grid I was expecting that `Self-Referencing` RadGridView means it uses own columns and rest visual stuff to display all nested child RadGridViews. Since it references the same type in the underlying data on every hierarchy level (that is self-referencing), it's obviously should display all levels in the same way (as it displays itself on top-level).
Turned out it was not the case. Each child level requires own visual template, own columns with own styling. We have about 20 columns with heavy styling each (more than 500 lines in .xaml) for top-level `RadGridView`. Copy-pasting all that into `RadGridView.HierarchyChildTemplate` is not an option.
In your demo application, I saw that you add columns manually for a child `RadGridView` from `RadGridView1_DataLoading` handler in code-behind. I was hoping it was a mistake.
I was looking at the https://www.telerik.com/forums/preview-(and-stop)-selectionchanged post from 5 years ago. In the first answer, there was an attached solution to the problem. If using the ItemsSource binding, you could prevent the change by not firing the OnPropertyChanged event.
I loaded this project using the 2025Q1 dlls and while the SelectedItem may not technically update, the UI reflects that the item is selected. Is there an updated solution to this?