This is a migrated thread and some comments may be shown as answers.

RadialMenu does not Hide in RadGridView

4 Answers 53 Views
RadialMenu
This is a migrated thread and some comments may be shown as answers.
Ahmet
Top achievements
Rank 1
Ahmet asked on 06 Dec 2019, 05:58 PM

Hi dear Telerik Team, 

 

I'm just facing an issue which took me Hours to (possibly :) ) understand.

 

I'm using a RadialMenu via RadialContextMenu in a RadGridView. While my RadialMenu did not Hide as it was intended, I guess I can reproduce this in a simple Environment as well: 

Usually RadialMenu behaves as inteded. 

However if Opening the RadialMenu with MouseRightClick on a ColumnHeader (instead on one of the rows), every intend of hiding that RadialMenu via "RadialMenuCommands.Hide.Execute(null, null);" Fails. 

After somehow Closing it (via rightclick on a row), it reopens, however hiding again Fails. 

I have just retested in another sample: RadialMenu is especially not Hiding if you just select a cell and without causing any other Events also Right-click same GridCell to open the Radial Button. Now after leaving the RadialMenu it should hide because there is an Event on MouseLeave which is invoking RadialMenuCommands.Hide.Execute(null, null). However that does not take effect.

Am I overseing something? Can you help?

 

Can't attach my Code. How can I? 

4 Answers, 1 is accepted

Sort by
0
Ahmet
Top achievements
Rank 1
answered on 06 Dec 2019, 08:09 PM

this is my Code: 

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:TelereikWPFTests"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="TelereikWPFTests.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <telerik:RadGridView ItemsSource="{Binding MyData, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MainWindow}}" Margin="25,25,3,25"
                             AutoGenerateColumns="True" MouseUp="RadGridView_MouseUp" >
            <telerik:RadRadialMenu.RadialContextMenu>
            <telerik:RadRadialMenu IsOpen="True"
                                   ShowEventName="MouseRightButtonUp"
                                   HideEventName="LostFocus"
                                   PopupPlacement="Mouse"
                                   StaysOpenOnShow="True"
                                   MouseLeave="RadRadialMenu_MouseLeave">
                    <telerik:EventToCommandBehavior.EventBindings>
                        <telerik:EventBinding EventName="MouseLeave" Command="{x:Static telerik:RadialMenuCommands.Hide}" />
                    </telerik:EventToCommandBehavior.EventBindings>
                    <telerik:RadRadialMenuItem Header="Item 1">
                    <telerik:RadRadialMenuItem Header="Sub Item 1.1"/>
                    <telerik:RadRadialMenuItem Header="Sub Item 1.2"/>
                    <telerik:RadRadialMenuItem Header="Sub Item 1.3"/>
                </telerik:RadRadialMenuItem>
                <telerik:RadRadialMenuItem Header="Item 2">
                    <telerik:RadRadialMenuItem Header="Sub Item 2.1"/>
                    <telerik:RadRadialMenuItem Header="Sub Item 2.2"/>
                    <telerik:RadRadialMenuItem Header="Sub Item 2.3"/>
                </telerik:RadRadialMenuItem>
            </telerik:RadRadialMenu>
            </telerik:RadRadialMenu.RadialContextMenu>
        </telerik:RadGridView>
    </Grid>
</Window>

…. and the Code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
namespace TelereikWPFTests
{
    /// <summary>
    /// Interaktionslogik für MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        public List<AnyValues> MyData
        {
            get
            {
                var Assets = new List<AnyValues>() {
                    new AnyValues("ölkö", "weqe", "dasds", "tret"), new AnyValues("ölkö", "weqe", "dasds", "tret"), new AnyValues("ölkö", "weqe", "dasds", "tret"), new AnyValues("ölkö", "weqe", "dasds", "tret")
                };
                return Assets;
            }
        }
        public class AnyValues
        {
            public AnyValues(string v1, string v2, string v3, string v4)
            {
                Value1 = v1; Value2 = v2; Value3 = v3; Value4 = v4;
            }
            public string Value1 { get; set; }
            public string Value2 { get; set; }
            public string Value3 { get; set; }
            public string Value4 { get; set; }
        }
        private DependencyObject poppyUp;
        private void RadRadialMenu_MouseLeave(object sender, MouseEventArgs e)
        {
            RadialMenuCommands.Hide.Execute(null, null);
            System.Diagnostics.Debug.WriteLine("Sould be Hidden");
        }
    }
}

 

0
Accepted
Vladimir Stoyanov
Telerik team
answered on 11 Dec 2019, 11:47 AM

Hello Ahmet,

Thank you for the share code snippets. 

Please, note that the ShowEventName and HideEventName properties of the RadRadialMenu indicate on which events of its target (in your scenario the RadGridView) it should close. I am assuming that the LostFocus event of the RadGridView is not called when clicking on its cells. 

That said, you can utilize the  RadialMenuCommands.Hide, however you need to pass as the 2nd parameter the target RadGridView. I am attaching a sample project based on the provided code to demonstrate what I have in mind. Please, check it out and let me know, if it helps. 

Regards,
Vladimir Stoyanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ahmet
Top achievements
Rank 1
answered on 11 Dec 2019, 05:45 PM

Hi Vladimir,

 

thanks a lot! 

This was what I was Looking for:

RadialMenuCommands.Hide.Execute(null, this.gridView);

 

Kind regards

Ahmet

0
Vladimir Stoyanov
Telerik team
answered on 12 Dec 2019, 01:37 PM

Hello Ahmet,

I am glad to hear that you found the previous reply helpful. 

Don't hesitate to contact us again, if you have any other questions.

Regards,
Vladimir Stoyanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
RadialMenu
Asked by
Ahmet
Top achievements
Rank 1
Answers by
Ahmet
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or