4 Answers, 1 is accepted
0
Sammy
Top achievements
Rank 1
answered on 17 Jul 2014, 05:14 AM
Hi Donovan,
You should create a derived usercontrol class from RadDiagramConnection class. Then, on the xaml you can edit the ContentTemplate of your custom usercontrol.
Regards,
Semih
You should create a derived usercontrol class from RadDiagramConnection class. Then, on the xaml you can edit the ContentTemplate of your custom usercontrol.
Regards,
Semih
0
donovan
Top achievements
Rank 1
answered on 17 Jul 2014, 01:13 PM
Hi Semih,
Thanks for the idea. This is what I tried
<telerik:RadDiagramConnection x:Class="Desktop.Shapes.Connection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:desktop="clr-namespace:Desktop"
xmlns:viewModels="clr-namespace:Desktop.ViewModels"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<telerik:RadDiagramConnection.DataContext>
<viewModels:ConnectionViewModel/>
</telerik:RadDiagramConnection.DataContext>
<telerik:RadDiagramConnection.ContentTemplate>
<ItemContainerTemplate>
<Grid>
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu>
<telerik:RadMenuItem Command="desktop:Commands.PropertiesCommand" CommandParameter="{Binding}" />
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
</Grid>
</ItemContainerTemplate>
</telerik:RadDiagramConnection.ContentTemplate>
</telerik:RadDiagramConnection>
But I still get the context menu of the RadDiagram and not the connection. I created my own RadDiagram derived class and I overrode GetConnectionContainerForItemOverride and IsItemItsOwnConnectionContainerOverride to make sure my connection was used.
Can you see what I am doing wrong?
Thanks
Donovan
Thanks for the idea. This is what I tried
<telerik:RadDiagramConnection x:Class="Desktop.Shapes.Connection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:desktop="clr-namespace:Desktop"
xmlns:viewModels="clr-namespace:Desktop.ViewModels"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<telerik:RadDiagramConnection.DataContext>
<viewModels:ConnectionViewModel/>
</telerik:RadDiagramConnection.DataContext>
<telerik:RadDiagramConnection.ContentTemplate>
<ItemContainerTemplate>
<Grid>
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu>
<telerik:RadMenuItem Command="desktop:Commands.PropertiesCommand" CommandParameter="{Binding}" />
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
</Grid>
</ItemContainerTemplate>
</telerik:RadDiagramConnection.ContentTemplate>
</telerik:RadDiagramConnection>
But I still get the context menu of the RadDiagram and not the connection. I created my own RadDiagram derived class and I overrode GetConnectionContainerForItemOverride and IsItemItsOwnConnectionContainerOverride to make sure my connection was used.
Can you see what I am doing wrong?
Thanks
Donovan
0
Sammy
Top achievements
Rank 1
answered on 17 Jul 2014, 01:17 PM
Hi Donovan,
I think there is a mistake on the xaml, can you replace <ItemContainerTemplate> under <telerik:RadDiagramConnection.ContentTemplate> with <DataTemplate>.
I think there is a mistake on the xaml, can you replace <ItemContainerTemplate> under <telerik:RadDiagramConnection.ContentTemplate> with <DataTemplate>.
0
donovan
Top achievements
Rank 1
answered on 17 Jul 2014, 01:22 PM
I got it!
<telerik:RadDiagramConnection x:Class="Desktop.Shapes.Connection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:desktop="clr-namespace:Desktop"
xmlns:viewModels="clr-namespace:Desktop.ViewModels"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<telerik:RadDiagramConnection.DataContext>
<viewModels:ConnectionViewModel/>
</telerik:RadDiagramConnection.DataContext>
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu>
<telerik:RadMenuItem Command="desktop:Commands.PropertiesCommand" CommandParameter="{Binding}" />
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
</telerik:RadDiagramConnection>
<telerik:RadDiagramConnection x:Class="Desktop.Shapes.Connection" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:desktop="clr-namespace:Desktop"
xmlns:viewModels="clr-namespace:Desktop.ViewModels"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<telerik:RadDiagramConnection.DataContext>
<viewModels:ConnectionViewModel/>
</telerik:RadDiagramConnection.DataContext>
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu>
<telerik:RadMenuItem Command="desktop:Commands.PropertiesCommand" CommandParameter="{Binding}" />
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
</telerik:RadDiagramConnection>