Using this example as a base, I created a custom class to add a special right click menu onto any RadGridView item:
Example: https://github.com/telerik/xaml-sdk/blob/master/GridView/CopyPasteFunctionality/GridViewClipboardContextMenu.cs
Code:
public
GridViewCopyContextMenu(RadGridView grid)
{
this
.gridView = grid;
Image iconCopy =
new
Image() {
Stretch = Stretch.None,
Source =
new
BitmapImage(
new
Uri(
"/Images/copyIcon.png"
, UriKind.RelativeOrAbsolute))
};
this
.contextMenu =
new
RadContextMenu();
this
.contextMenu.Items.Add(
new
RadMenuItem() { Header = GridViewCopyContextMenu.COPY_SELECTED_CELL_WITHOUT_HEADER_HEADER });
this
.contextMenu.Items.Add(
new
RadMenuItem() { Header = GridViewCopyContextMenu.COPY_SELECTED_CELL_WITH_HEADER_HEADER });
this
.contextMenu.Items.Add(
new
RadMenuItem() { Header = GridViewCopyContextMenu.COPY_SELECTED_ROW_WITHOUT_HEADER_HEADER });
this
.contextMenu.Items.Add(
new
RadMenuItem() { Header = GridViewCopyContextMenu.COPY_SELECTED_ROW_WITH_HEADER_HEADER });
this
.contextMenu.Items.Add(
new
RadMenuItem() { Header = GridViewCopyContextMenu.COPY_ALL_ROW_WITHOUT_HEADER_HEADER });
this
.contextMenu.Items.Add(
new
RadMenuItem() { Header = GridViewCopyContextMenu.COPY_ALL_ROW_WITH_HEADER_HEADER });
this
.contextMenu.Opened += RadContextMenu_Opened;
this
.contextMenu.ItemClick += RadContextMenu_ItemClick;
RadContextMenu.SetContextMenu(
this
.gridView,
this
.contextMenu);
}
If I modify any single item to add "Icon = iconCopy, " into the properties, I get the following runtime error:
Category: ParserError
Message: Failed to assign to property 'System.Windows.Controls.ContentPresenter.Content'.
I've tried using "/Images/copyIcon.png" and "MyProject;component/Images/copyIcon.png"; the end result is the same. If I put the source with the either format in xaml on a RadContextMenu, I can see the actual intended image during design time, but I get the same runtime error during runtime.
What can I do to fix this so my icon will show? I am using Silverlight 5, on Runtime Version v4.0.30319, with Telerik Version 2014.1.224.1050.
Thanks
I have a radTreeListView with multiple parent nodes,which can contain multiple child nodes which can also contain multiple sub-child nodes.
I want to make sure only 8 items are selected and no more than that. Those 8 selections MUST also be under the same parent node.
I have a situation where I am trying to setup my project to use the RadMenu control. I have copies of the Telerik 2011 Q2 Retail Binaries in a 3rdParty folder within the solution. I reference those files in my project and create a simple implementation of the RadMenu,
<
telerik:RadMenu
Grid.Row
=
"0"
>
<
telerik:RadMenuItem
>
<
telerik:RadMenuItem
>Title</
telerik:RadMenuItem
>
</
telerik:RadMenuItem
>
</
telerik:RadMenu
>
At this point, I get the HRESULT error,
Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
Now, if I were to use the RadControls Silverlight Application project, and repeat the same workflow, I would get a page that would work just as expected.
So I ask, is adding the DLL's to a Silverlight project an unsupported means to include telerik controls?
Thanks
Rick