Telerik Forums
UI for WPF Forum
1 answer
135 views

Hello,

I want to have a custom contextmenu per cell, I implemented this succesfully with the example given in this thread.

Now I want to add the functionality that the contextmenu will be displayed based on the row where the cursor is and the contextmenu is called, in another thread they point me to the RadContextMenu example of the Telerik Demos. 

So I created a custom class which inherits from the RadContextMenu and attach an implementation for the open event:

protected void GridViewContextMenu_Opened(object sender, RoutedEventArgs e)
{
    RadContextMenu menu = (RadContextMenu)sender;
    GridViewRow row = menu.GetClickedElement<GridViewRow>();
 
    if (row != null)
    {
        row.IsSelected = row.IsCurrent = true;
        GridViewCell cell = menu.GetClickedElement<GridViewCell>();
        if (cell != null)
        {
            cell.IsCurrent = true;
        }
    }
    else
    {
        menu.IsOpen = false;
    }
}

 

created 4 different contextmenus, 1 default and 3 other that depend on the cell where the user calls the contextmenu.

When I try setting this custom contextmenu in XAML as default for my GridView and as contextmenu for some cells using styles. I receive an InvalidOperationException stating that the given contextmenu is not a valid value for the ContextMenu property?

It worked with the regular ContextMenu, but when I change my custom ContextMenu to inherit from this class I cant call the function GetClickedElement<GridViewCell>()?

 

How can I solve this, I dont exactly understand why I get this exception with RadContextMenu and not with a regular ContextMenu.

Any help would be appreciated.

Regards,

 

Marcel

 

Stefan
Telerik team
 answered on 09 May 2016
5 answers
1.3K+ views

I'm trying to iterate through my RadGridView rows, but when I have more than 20 or 30 items, the loop doesn't get all rows.
For example: using this code in a radgridview with 5 items, I can get all of them and do whatever I want, but when my grid has more than 20 items, it gets only 10 rows. Is this a bug or something like that? How can I solve it?
Here's my code:

 

01.private List<object> ReturnListFounds(string text)
02.        {
03.            List<object> a = new List<object>();
04.            foreach (var item in myGrid.Items)
05.            {
06.                if (item == null)
07.                    continue;
08.                GridViewRow row = myGrid.ItemContainerGenerator.ContainerFromItem(item) as GridViewRow;
09. 
10.                if (row == null)
11.                    continue;
12. 
13.                foreach (GridViewCell cell in row.Cells)
14.                {
15.                    if (cell != null && cell.Value != null)
16.                    {
17.                        string str = cell.Value.ToString();
18. 
19.                        if (str.Equals(text, StringComparison.InvariantCultureIgnoreCase) || str.ToLower().Contains(text.ToLower()))
20.                        {
21.                            a.Add(row.Item);
22.                            break;
23.                        }
24.                    }
25.                }
26.            }
27. 
28.            return a;
29.        }

Dilyan Traykov
Telerik team
 answered on 09 May 2016
1 answer
214 views

Hello,
I am using RadCartesianChart with multiple series. I am using ScatterLineSeries. 

My requirement is, I want to click on ScatterLineSeries and show a Popup window with details related to that series.

Is it possible with RadCartesianChart and scatter lines series ? If so, how ? If not, what is the other way to do this ?

Petar Marchev
Telerik team
 answered on 09 May 2016
16 answers
470 views
I know you can double click the ScheduleView and show the add/edit appointment dialog, is it possible to show it using code behind (C#)?
Kalin
Telerik team
 answered on 09 May 2016
1 answer
121 views

I have a listbox which the user can drag from and drop on a scheduleview.. however I've restricted the user so that they can't drop back onto the listbox and therefore they also can't re-order the listbox.

To get this working was simple enough - however I had a bit of difficulty getting rid of the DropVisual that happens when you hover on the listbox with an item you are dragging.  (The visual I am talking about is the bar that appears above/below each listboxitem to indicate where it is going to drop - I want to get rid of this because the user can't drop here - I'm surprised its not supressed when AllowDrop is set to False).

I tried setting the DropVisualProvider to null on the Listbox itself - this in turn caused loads of silent NullReferenceExceptions and caused flickering when holding an item over the ListBox.  I then set the DropVisualProvider to a class which inherited from LinearDropVisualProvider and overrode the CreateDropVisual method to just return a blank StackPanel - this works flawlessly, but is there an easier/less hacky way of achieving this?

Masha
Telerik team
 answered on 09 May 2016
9 answers
315 views
I am trying use RibbonView in my prism project. I want to have each module inject its own Ribbon Tab . I have gotten this work following the PribbonViewPrism example project.

I have just one problem. I want the initial Screen to display a login control. This screen should not display the Ribbon View.

In all examples, the RibbonView is "baked into the shell". So, when I display the screen it shows the empty RibbonView.

I tried to add the RibbonView as a Module too. I added a ContentControl that is mapped to the "RibbonRegioon" in teh shell. Then I load the ribbonView and ribbontabs into this region. RibbonView is loaded and displayes. When I try and load a RibbonTab, it  does not work because,  RibbonView is not defined as a Region in the shell and is just another view.

How to get this to work?. Is there a way to load the RibbonView Region without displaying in the initial screen?
Kiril Vandov
Telerik team
 answered on 09 May 2016
2 answers
193 views

When the ribbon group is in collapsed mode and it contains a combo box, how can I prevent the group from closing when an item in the combo box is selected? It's causing some unwanted behavior due to other events attached to the combo box, which doesn't happen when the group is not collapsed.

Geoffrey
Top achievements
Rank 1
 answered on 09 May 2016
3 answers
169 views
Hi,
   i have a raddocking inside which radpanes are added. if i remove a radpane from raddocking it becomes float pane. Now if i overlap(not fully) the raddocking such that raddocking is beneath the toolwindow. if i click the radpane now, toolwindow remains top and raddocking is still below the toolwindow. But i want raddocking to come on top.
Kalin
Telerik team
 answered on 09 May 2016
1 answer
275 views

Hi,

I have a database in which images are stored by its URLs,

so I'd like to use the url to load image from viewmodel to view.

Thanks.

 

Todor
Telerik team
 answered on 09 May 2016
14 answers
120 views

We are currently replacing an old Infragistics docking manager with your control, and with the old code, we've prevented the floating of windows.

However, the user could still move panes around to a different location, and change the layout (Just like with DragDropMode is set to Deferred).

 

I would like to support the legacy mode (Which will be the default) which will behave just like the Deferred DragDropMode. I also want the user to be able to change an option in the program, which will change the DragDropMode to Immediate.

 

This, however, doesn't work as expected...

If changing from Immediate to Deferred:

* Docked panes are not movable (no compass and no deferred adorner is being shows)

* Floating panes that are being docked do have the compass and the deferred adorner, when you try to move them after they were docked. 

 

If you change is back from Deferred to Immediate:

* Panes that you could not move can be moved (and then become floating) again/

* The panes that did have  the compass and the deferred adorner, don't move when you try to drag them. However, when you release the mouse button, then the start moving with the mouse pointer... without any mouse button pressed.

 

Thanks

Nasko
Telerik team
 answered on 06 May 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?