Telerik Forums
UI for WPF Forum
1 answer
45 views

Hi,

What I'm tryin to do is create an App that starts hidden (without a RadWindow) and when you click on a context menu of NotifyIcon it shows a RadWindow. I've tried several options and none work correctly.

What would be the best approach for this scenario?

 

Thanks

Martin Ivanov
Telerik team
 answered on 30 Mar 2023
1 answer
89 views

Today I tried to put a context menu on a row in a RadGridView that would operate on the row clicked.  I was surprised to find it was not nearly as trivial as I expected.  All the documentation on this is either very old or accomplishing it via code or code-behind.  The "official" demo even has an entry for "Row Context Menu", which sounds tantalizingly close until one looks at the code.  It's certainly not MVVM!

This should be as simple as the following:

<telerik:RadGridView ItemsSource="{Binding Path=MyRecords}">
    <telerik:RadContextMenu.ContextMenu>
        <telerik:RadContextMenu >
            <telerik:RadMenuItem Header="Do something to this record" Command="{Binding MyRowCommand}" CommandParameter="{Binding ?????}" />
        </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
	...
</telerik:RadGridView>

The problem is that I can't for the life of me figure out what to pass as the command parameter that will help me identify the row.

Any help would be much appreciated!

Martin Ivanov
Telerik team
 answered on 29 Mar 2023
0 answers
44 views

Hi,

We have switched over from using WPF's built in ContextMenu's to RadContextMenus and we are using Prism Delegated commands.

We have set the "tag" property of the UI element (that has the RadContextMenu attached to it) to an ElementReference to the containing window so that we can then use UIElement.Tag to get back to the Window to then bind to it's PrintCommand.

This all works well, however if we open the ContextMenu from code behind using contMenu.IsOpen = True then the UIElement property is not being set to anything so the command cannot be found.

Is there a different way we should be bindiing the RadContextMenu items to the view commands?

Thanks,

 


<telerik:RadContextMenu  DataContext="{Binding Path=UIElement.Tag, RelativeSource={RelativeSource Self}}" InheritDataContext="False">
   <telerik:RadMenuItem Header="Print" InputGestureText="Ctrl+P"
                                       Command="{Binding PrintCommand}" />
</telerik:RadContextMenu>

Peter
Top achievements
Rank 1
 asked on 16 Mar 2023
1 answer
108 views

I"m following example for context menu in grid view:

https://docs.telerik.com/devtools/wpf/controls/radcontextmenu/how-to/use-radcontextmenu-with-radgridview

Sample grid view has context menu on clicking record: Add/Edit/Delete.

Need advice how to create dynamic context menu on-the-fly based on selected row, using parent-child nodes approach like:

- Notify Option1

      - client 1

      - client 2

      - client <...> (items number is variable based on selected row)

- Notify Option2

      - department1

      - department2

      - department<...> (variable)

- Delete

I'm wonder if it is possible to populate menu items in Click_Row() event instead of static init process this.InitializeRowContextMenuItems();

Another approach would be creating separate dialog inside Click_Row() listing all items for each category "Notify Option1", "Notify Option2". But dynamic menu context looks more clean approach.

 

Martin Ivanov
Telerik team
 answered on 01 Feb 2023
1 answer
124 views

Hello,

I created the ColumnsVisibility attached property to the RadGridView.

When the user clicks the columns' header, I open a context menu that shows all the columns.

Then the user can show/hide the columns by updating the IsVisible property. I am interested to add a button to the left of the first columns header.

The new button will open the Context Menu instead of clicking the Column Header.

I need this functionality because if the users hides all the colums, then there is no header and he will not able to open the menu at all, which means the columns visibilty can't be restored.

I can't attach the property to the RadGridView itself because I have another menu there.

A better solution may be to add this attached property to another style of a control part in the RadGridView template.

I am wondering if there is another control in your template (under the GridViewColumnHeader).

 

At the end I need to open a context menu in the top of the RadGridView but in parallel to open a different ContextMenu when the user clicks and empty space in the rest of the RadGridView (middle/bottom).

Martin Ivanov
Telerik team
 answered on 25 Nov 2022
1 answer
113 views

I have the following ContexMenu:

Which has the following xaml:

<telerik:RadContextMenu.ContextMenu>
  <telerik:RadContextMenu Opened="RadContextMenu_Opened">
    <telerik:RadMenuItem Header="Add" Command="{Binding AddInstance}" IsEnabled="{Binding EpmModelEditModeEnabled}"
                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadContextMenu}}, Path=UIElement.SelectedItem}"
                    Visibility="{Binding EnableEditMode, Converter={StaticResource boolToVisibilityConverter}}"/>
    <telerik:RadMenuItem Header="Rename (F2)" Click="RenameItemMenu_Click" IsEnabled="{Binding EpmModelEditModeEnabled}"
                      Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadContextMenu}}, Path=UIElement.SelectedItems, Converter={StaticResource canRenameModelVisibilityConverter}}"/>
    <telerik:RadMenuItem Header="Delete" Command="{Binding DeleteObject}" IsEnabled="{Binding EditModeEnabled}"
                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadContextMenu}}, Path=UIElement.SelectedItems}"/>
    <telerik:RadMenuItem Header="Create Chart Analysis" Command="{Binding CreateChart}" 
                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadContextMenu}}, Path=UIElement.SelectedItems}"/>
    <telerik:RadMenuItem Header="Create Dataset Analysis" Command="{Binding CreateDataset}" 
                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadContextMenu}}, Path=UIElement.SelectedItems}"/>
    <telerik:RadMenuItem x:Name="ColumnsMenu" Header="Columns">
      <telerik:RadMenuItem.ItemTemplate>
        <HierarchicalDataTemplate>
          <MenuItem Header="{Binding Header}" IsCheckable="True" IsChecked="{Binding IsVisible, Mode=TwoWay}"/>
        </HierarchicalDataTemplate>
      </telerik:RadMenuItem.ItemTemplate>
    </telerik:RadMenuItem>
  </telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>

I need to know how do i change the size of the internal selection (in blue) to match the size of the external selection (in yellow), because when i click in the external selection the context menu closes.

At least, if it is not possible to change the size of the internal selection, i need that the context menu does not close when the external selection is clicked (adding StaysOpenOnClick="True" in the MenuItem inside of the <HierarchicalDataTemplate> does not work).

Martin Ivanov
Telerik team
 answered on 10 Nov 2022
0 answers
56 views

I have a radpane include a context menu. when right click over context menu, Radpane is closing and it'is problem for this component.
I used contextmenuopening event but it works before closing and it is not good idea

code is below:




<telerik:RadPaneGroup  Margin="0,0,0,0" >
                    <telerik:RadPane  Name="PaneProcess" CanUserClose="False" >
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="24" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <telerik:RadWatermarkTextBox x:Name="FilterTree" Grid.Column="0" Grid.Row="0" BorderThickness="1"
					 Margin="0,0,0,0"
					 VerticalAlignment="Top" 
					 MinHeight="24" />
                            <c:TreeViewProcess x:Name="treeViewProcess" IsDragDropEnabled="True" Grid.Row="1" />
                        </Grid>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>

Cemil
Top achievements
Rank 1
Iron
 asked on 09 Jun 2022
2 answers
53 views

Hello,

I need a way to Drag & Drop an Item from the Context Menu and then GridView Columns to reordered based on the Context Menu Items ordering. This is for a WPF application.

As I understood this is not supported, I am writing here in any case I just didn't find the solution.

 

Thank you !!

Marios
Top achievements
Rank 1
Iron
 answered on 10 Feb 2022
1 answer
61 views

Hi,

I have a RadContextMenu and want to use access keys with it, I've added underscores to headers in my RadMenuItems and functionally it's all working however the characters in the menu aren't underlined, I tried looking into this online but could only seem to find anything on getting them to appear in a RadMenu when using alt which doesn't appear to be an option for the context menu control. It seems like it should be default functionality so I don't know if maybe I'm just missing something obvious.

Thanks for any help

Stenly
Telerik team
 answered on 14 Dec 2021
1 answer
195 views

Hello.

 

I want to make it similar to an image.

I made the design, but binding is the problem.
There is a model, there is a displayname, and there are values.

The dropdown shows the sub item name when selected, and the value uses the value when the button is selected later.

(I know listbox doesn't support this. So I try to use dropdown.)

A parent item may have a value and a child may not. This shouldn't be an option.

The IsSelected function does not exist.

 

How do I put the binding and do it?

<telerik:RadDropDownButton Content="{Binding }">
	<telerik:RadDropDownButton.DropDownContent>
		<telerik:RadContextMenu x:Name="ContextMenu" ItemsSource="{Binding }">
			<telerik:RadMenuItem Header="parent name binding 1">
				<telerik:RadMenuItem Header="child name binding 1.1"/>
				<telerik:RadMenuItem Header="child name binding 1.2"/>
				<telerik:RadMenuItem Header="child name binding 1.3"/>
			</telerik:RadMenuItem>
			<telerik:RadMenuItem Header="parent name binding 2">
				<telerik:RadMenuItem Header="child name binding 2.1"/>
				<telerik:RadMenuItem Header="child name binding 2.2"/>
			</telerik:RadMenuItem>
			<telerik:RadMenuItem Header="parent name binding 3">
				<telerik:RadMenuItem Header="child null"/>
			</telerik:RadMenuItem>
		</telerik:RadContextMenu>
	</telerik:RadDropDownButton.DropDownContent>
</telerik:RadDropDownButton>

 

Thanks.

 

Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
 answered on 28 Jun 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?