Grids - Action Column to behave like a Flyout Menu - extjs

I'm using ExtJS for my project and can see that there is a way to embed "actioncolumns" inside of Grid columns. However, my "action" isn't just a single click, it actually needs to show a flyout menu (similar to the Menu control). Is there a direct way to do this in Ext? Or do I have to implement all this functionality myself?

There is no direct way. You need to create a menu and show it manually in the event handler for action button. You can also show menu as a context menu for the grid (right click).

Related

Hide the close button on the context-sensitive menu? (XAF)

I want to remove the close button from the context-sensitive menu that appears when I right click a record in list view.
I found instructions how to do it for web forms but I am using Winforms.
I don't want to deactivate the controller because I still need the close button on the main toolbar.
I am wondering whether to move the barContainerClose from the barContainerView
In the template

Angular UI-grid options

Currently I have a grid that has a option to click and show the grid options on the far right side. The issue I'm having and I am wondering if there is a setting I can add for the grid options dropdown to automatically close when a user clicks off anywhere else or opens one of the column drop down options. Any ideas?
There does not appear to be a setting for this in the API. I assume you are using CellNav, which is the cause of this. The reason clicking on the grid cells or header cells doesn't close the grid menu is that cellnav is eating the click event.
If you are using CellNav, you may notice that the column menus do not close when clicking within cells, either.
You need to add a different event listener (let's go with mouseup) and programmatically close the menus.
Here is an example of how to achieve this using the gridApi and onRegisterApi grid option.

Implementation of menu buttons in WPF/MVVM/Prism

I have a Region in the top left of the WPF application which I want to be my global button bar where the user chooses which screen they want to view, and the appropriate content will then be displayed in the main region. THere will also be a sub navigation region in the top right with sub-menu options within that screen, eg if the user clicked "Maintenance" from the main menu, the sub menu would show options for New, Update, Delete, Edit etc.
What I want to have is a way to create a custom menu bar by simply specifying a list of Text button names, and ICommand/Parameter pairs for the action to invoke on button click. The natural way to do this would be have a MenuButtonViewModel class with dependency properties Title, Command and CommandParameter. One more would also be needed, IsSelected, so there is some visual way for the user to see which screen you are currently on, so it needs to behave like a toggle button, but where only one button in the group can be selected at a time. I can then have a UserControl where the content of the bar binds to an ObservableCollection and uses data templates to render the button bar.
I have tried a few ways of doing this so far but cannot figure out a way that gives me the visual behaviour I want. These are my requirements
1) Button to change background to a different Brush OnMouseOver
2) When button is selected, a different Brush is displayed as the background until a new button in the group is selected, like a togglebutton IsSelected behaviour
3) Only one button in the group can be selected at a time
The ways I have tried to do this so far are
1) Extending RadioButton with my own class, adding dependency properties for command and commandparameter. Setting all controls to have the same group Id. Data template to override display of radio button to make it look like a visual button with triggers for mouseover and isselected.
This works fine, except for one thing. Once you select a radio button in a group, there is no way to deselect all options in the radio button group. So if you navigate to "maintenance" and then click the sub menu for "Countries" for example, then you are displayed the country maintenance screen. If you then go to a different area of the app and select "Deal Entry" from the main menu, you are taken to the deal entry screen. If you then click "Maintenance", it displays the generic "maintenance" content and brings back the sub menu control for maintenance, where "Country" is selected in the radio button group, but this is undesirable. When you navigate back to Maintenance, it should deselect all sub menu options, display the generic maintenance landing page content and let you select a sub menu option before displaying that screens content. The first time you load Maintenance, nothing is selected, but once you have chosen an option, then there is no way to have nothing selected again when you reload the maintenance screen.
2) I then tried extending a ListBox, styling it with a horizontal stackpanel for the content, each listboxitem is a menubuttonViewModel. This allows me to only select a single option at a time and to clear the selection when you navigate away from the page. It also lets me change the background when you mouse over each listboxitem.
The bit I can't get working with the listbox is to have the background different on the IsSelected trigger. There seems to be some trigger on the default ListBoxItem template that overrides anything you specify in CSS so no matter what trigger I put on the listboxitem or menubuttonviewmodel style, the background simply does not change. I think I need to redefine the data and content template for listboxitem, but only have it apply for this listbox, so it can't be a global template change to all listboxitems - as I want to be able to use listboxes elsewhere in the app without inheriting this behaviour.
Can anyone give their thoughts on these two approaches and how to perhaps solve the issues I'm having to make one of them work in the way I want, particularly if you can advise how I can override the content/data template for the listboxitems in my style so they do not use the default triggers, and I can get the IsSelected trigger working for me?
If I understood correctly, you would want to clear the selection on the RadioButtons from the Sub-Menu each time you navigate back from another Main Menu option.
In order to solve this, you could have every Radio Button "unchecked" by manually setting the RadioButton´s IsChecked property value to false. A possible solution could be the following:
If you want to clear any checked option from the Sub-Menu everytime you navigate to a different section of the Main Menu, you could first notify to the Sub-Menu´s ViewModel by publishing an event using the EventAggregator after selecting and clicking a different MainMenu button, from the SelectionChangedEventHandler method of the Main Menu´s ViewModel.
Therefore, the Sub-Menu EventHandler of the published event would update each RadioButton´s IsChecked property value to false, which it could be accomplished by using a "Two-Way" Binding between each IsChecked property defined on the View, and each boolean "RadioButton1IsChecked" property implemented on the ViewModel.
I hope this helped you.

Dropdown menu overlaps other controls

In my WPF application I would like to get a dropdown menu under some other elements in the window. When menu is expanded it overlaps other controls. But I need these controls remain over the menu anytime.
I tried to play with ZIndex, but without any success.
Is it possible somehow to show dropdown menu under other controls?
Thanks for help!
You cannot achieve this with a drop-down menu, because by definition it is displayed on a separate window above the current window.
So if you want some control to appear under other controls, you have to use just normal controls like Grid, make them invisible at the beginning, and show as soon as you need the "dropdown" to appear (and of course hide afterwards).

insert radiobox in menu in forms

How can I insert radiobutton in Menu as Menu item. I use WinForms and there I see only few option to insert other controls, but no radio :/
Also it's impossible to drag it from Controls and drop in menu in Design View :/
That's probably because an actual "radio button" control as a menu item would be weird, when you can already show a menu item as "checked" using the "radio button style". See the MenuItem.RadioCheck property.
If you really do want to do this, create an owner drawn menu. This is pretty straightforward. Here's a tutorial:
http://www.csharphelp.com/2006/08/ownerdraw-menu-items-in-c/
As for drawing the radiobuttons, use the static functions of the ControlPaint class.

Resources