Can someone please inform me how you can set this type of control either in xaml or code behind to be in TypeOver mode rather than Insert mode?
I have searched the web and can't seem to find anything...
<telerik:RadToolBarTray telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True" ItemsSource="{Binding MergedToolbarCommands}" x:Name="ToolbarTray"> <telerik:RadToolBarTray.ItemTemplate> <DataTemplate> <telerik:RadToolBar ItemsSource="{Binding}" OverflowMode="AsNeeded"> <telerik:RadToolBar.ItemContainerStyle> <Style TargetType="{x:Type ContentPresenter}"> <Setter Property="ToolBar.OverflowMode" Value="Never" /> </Style> </telerik:RadToolBar.ItemContainerStyle> </telerik:RadToolBar> </DataTemplate> </telerik:RadToolBarTray.ItemTemplate></telerik:RadToolBarTray>
I am trying to create custom Shape and custom ContainerShape.
I have successfully customized Shape.
But I am having a problem with customizing ContainerShape.
Below is code snippet for Model, .xaml and .cs.
When I set targetType of <style> to either Telerik:RadDiagramShape or Telerik:RadDiagramContainerShape, things work fine.
If I set CustomShape to targetType, this also works fine.
But, if I set CustomContainerShape to targetType, an error seems to occur when graphSource.AddNode(node) is excuted and StyleSelector returns Style, with InvalidOperationException error, and program terminates.
In the below code, FlowItemNode is okay. But FlowGroupNode is causing an error.
Even when I am using FlowGroupNode, if I set targetType of <style> to Telerik:RadDiagramContainerShape, it works okay.
I want to use CustomContainerShape so that I can implement or customize Drag and Drop(ex: drag entered, on drag, dropped) within CustomContainerShape class.
What am I doing wrong and How can I achieve this?
Thanks in advance.
//Selector
Class DiagramShapeSelector : StyleSelector
{
Public override Style SelectStyle(object item, DependencyObject container)
{
If(item is FlowItemNode)
{
Return ForShapeStyle
}
Else if (item if FlowGroupNode)
{
Return ForGroupShapeStyle
}
}
}
Code
//Model for shape
public class FlowItemNode : FlowItemViewModel, IDiagramNode
{
......
}
//Model for containerShape
Public Class FlowGroupViewModel<DiagramNode> : FlowItemViewModel, IContainerItem
{
}
Public class FlowGroupNode : FlowGroupViewModel<IDiagramNode>, IDiagramNode
{
......
}
xaml
<local:CustomDiagram
ShapeStyleSelector = {StaticResource DiagramShapeSelector}
……
/>
<Style x:Key="ForShapeStyle" TargetType="telerik:RadDiagramContainerShape">
<Setter Property="Position" Value="{Binding Position, Mode=TwoWay}" />
</Style>
<Style x:Key="ForGroupShapeStyle" TargetType="diagram:CustomContainerShape">
<Setter Property="Position" Value="{Binding Position, Mode=TwoWay}" />
</Style>
.cs
//Selector
Class DiagramShapeSelector : StyleSelector
{
Public override Style SelectStyle(object item, DependencyObject container)
{
If(item is FlowItemNode)
{
Return ForShapeStyle
}
Else if (item if FlowGroupNode)
{
Return ForGroupShapeStyle
}
}
}
// CustomRadDiagram
public class CustomDiagram : RadDiagram
{
protected override bool IsItemItsOwnShapeContainerOverride(object item)
{
if (item is FlowItemNode)
{
return item is CustomContainerShape;
}
else return item is CustomShape;
}
protected override Telerik.Windows.Diagrams.Core.IShape GetShapeContainerForItemOverride(object item)
{
if (item is FlowItemNode)
{
return new CustomContainerShape(this);
}
else return new CustomShape(this);
}
}
// CustomShape
public class CustomShape : RadDiagramShape
{
public CustomShape(CustomDiagram diagram)
{
}
}
// CustomContainershape
public class CustomConnection : RadDiagramConnection
{
public CustomConnection(CustomDiagram diagram)
{
}
}
Hello.
Sorry for my "English" :)
VirtualGrid was added in xaml markup and it was subscribed to OverlayBrushesNeeded using EventToCommandBehavior.
<telerik:RadVirtualGrid Name="VirtualGrid" HorizontalAlignment="Left" VerticalAlignment="Top" telerik:StyleManager.Theme="Office2016" CanUserInsertRows="False" CanUserEdit="True" InitialRowCount="10" InitialColumnCount="10" MeasureTextOnRender="True" DataProvider="{Binding DataProvider}" LinesVisibility="Both" CanUserSortColumns="False" CanUserFilterColumns="False" RowHeaderWidth="0" ColumnWidth="150" Grid.Column="2"> <telerik:RadVirtualGrid.ContextMenu> <ContextMenu ItemsSource="{Binding ContextMenuModel.Items}" ></ContextMenu> </telerik:RadVirtualGrid.ContextMenu> <telerik:EventToCommandBehavior.EventBindings> <telerik:EventBinding PassEventArgsToCommand="True" Command="{Binding VirtualGridOverlayBrushesNeeded}" EventName="OverlayBrushesNeeded"/> <telerik:EventBinding PassEventArgsToCommand="True" Command="{Binding VirtualGridCellDecorationsNeeded}" EventName="CellDecorationsNeeded" /> </telerik:EventToCommandBehavior.EventBindings> </telerik:RadVirtualGrid>
There are 2 commands in my ViewModel.
public ICommand VirtualGridCellDecorationsNeeded{ get => _virtualGridCellDecorationsNeeded;}public ICommand VirtualGridOverlayBrushesNeeded{ get => _virtualGridOverlayBrushesNeeded;}
_virtualGridCellDecorationsNeeded = new Telerik.Windows.Controls.DelegateCommand(OnCellDecorationsNeeded);_virtualGridOverlayBrushesNeeded = new Telerik.Windows.Controls.DelegateCommand(OnOverlayBrushesNeeded);public void OnCellDecorationsNeeded(object sender) { if(sender is CellDecorationEventArgs args) { if(args.ColumnIndex % 2 == 0) { args.Background = Brushes.Red; args.Foreground = Brushes.Black; args.CellTextAlignment = TextAlignment.Left; } else { args.Background = Brushes.Yellow; args.Foreground = Brushes.Red; args.CellTextAlignment = TextAlignment.Left; } } } public void OnOverlayBrushesNeeded(object sender) { if (sender is OverlayBrushesEventArgs args) { args.Brushes.Add(Brushes.Red); args.Brushes.Add(Brushes.Yellow); } }
CellDecorationsNeeded is triggered, but OverlayBrushesNeeded is not, which makes it impossible to set colors for cells. Please tell me what I'm doing wrong.
Please help me!,
I need to add a PictureBox in my main windows. It necessarily has to be in a PictureBox, please help.
I would still like to be able to see what row the scroll is at even when the mode is RealTime. Like Word, Excel, etc. can do. Is there any way to make that happen?
Absent using the template, is there any place to hook in to show something myself?

Hello.
Our project has a requirement to show an ExplorerControl where navigation is limited to a user-defined folder and its subfolders. Ideally, the navigation tree's root folder would be the specified folder (instead of the hierarchy from This PC to the target folder).
Is this functionality possible?
If there was a cancellable "OnBeforeNavigating" event to prevent navigating to parent folders, that might also be sufficient.
I've gotten close to it by handling the DirectoryRequesting event and cancelling any directories that are not the target folder, a parent folder, or child folder.
However, this still allows users to browse to parent folders and see the contents. If I try to cancel the DirectoryRequesting events for the parent folders too, the control stops working.
We looked into editing the control template, but it proved to be more in-depth than we want to go.
Thanks!
Hi,
We experience some strange behavior in the xaml designer (Visual Studio 2017) when we apply the Fluent theme on the TabControl
<Style x:Key="DefaultTelerikRadTabControlStyle" TargetType="telerik:RadTabControl"> <Setter Property="telerik:StyleManager.Theme" Value="{StaticResource FluentTheme}"/></Style><Style TargetType="{x:Type telerik:RadTabControl}" BasedOn="{StaticResource DefaultTelerikRadTabControlStyle}"/>
When the header of a tabitem is clicked, the designer does not 'switch' to that tab. This happens randomly (not all of the time) and is pretty annoying. Only thing to do when this happens is to restart Visual Studio.
The problem does not occur when setting the theme to Office2016.
Regards,
Hans
Hi there,
I would be appreciate your help with this.
Attached a screenshot that shows what I am looking for:
Thanks,
Bahram Afsharipoor