I am using a NavigationView with a Frame in a user control in WinUI 3 to navigate to a Page. What I want to do is set the background of the selected NavigationViewItem to match the background of the Page that is navigated to.
So far what I am doing is setting the NavigationView's resources using Resources["NavigationViewItemBackgroundSelected"] = the desired color in the Frame.Navigated handler. I also do the same for the "NavigationViewItemBackgroundSelectedPointerOver" resource since the pointer usually is over the item when the item is selected. Setting the resources this way only affects the one NavigationView in the user control, because I redefine these resources within the user control.
When I select a NavigationViewItem, I can see in the code that the resources are being set to the desired color. Unfortunately though, this does not result in the visual appearance of the NavigationViewItem being updated. The update does not happen until an action occurs such as pointer leaving the NavigationViewItem.
How can I force a refresh of the visual appearance of the NavigationView's SelectedItem after setting the "NavigationViewItemBackgroundSelected" and "NavigationViewItemBackgroundSelectedPointerOver" resources?
Related
Although the docs are pointing out:
The maximum number of items that can be added to the top-level browser action context menu is menus.ACTION_MENU_TOP_LEVEL_LIMIT, but you can add any number of items to submenus.
I am only able to add 1000 submenu items to the Chrome Extension context menu.
I don't want to create a UI additionally, because the context menu is really handy for my use case. The user is working in a code editor and can look up code syntax string values via the context menu and can add the value at the position of the cursor where the user right-clicked.
Do you know of such limitations or a workaround besides using an additional UI element?
Is it possible to change the context menu dynamically, once the tabulator table is already built?
I need to change the context menu according to the cell value under the mouse cursor, so if I could somehow change the context menu inside the cellMouseOver callback, that would be great.
Thanks,
Matic
Instead of specifying a menu object, what you want is a Menu Items Generator Function. The example on that page shows returning one menu if approved is false and a different menu if approved is true.
I want to add all menu items to the toolbar but only have a subset of them showing by default (without user having to customize). This way all menu items will have icons next to them, but the toolbar won't contain the seldom used items unless users adds them.
If possible, how is that done with CMFCToolBar?
If possible, how is that done with CMFCToolBar?
You can define any number of 'dummy' toolbar resources in your program's resource script, like the below example, where ID_DUMMY1 is the toolbar/bitmap resource ID (must be available to both the resource compiler and the C++ compiler) and the three ID_COMMAND_x IDs define the menu commands that the images correspond to:
ID_DUMMY1 BITMAP L"DummyToolbar.bmp" // 16 x 48 bitmap for three 'buttons
ID_DUMMY1 TOOLBAR 16, 16
{
BUTTON ID_COMMAND_A // Three commands corresponding to the three button
BUTTON ID_COMMAND_B // images in the above bitmap
BUTTON ID_COMMAND_C
}
Then, in your program (typically, just after you have initialized your main frame window), you can call the static member of the CMFCToolBar class, AddToolBarForImageCollection to load the images from those dummy toolbars. The following will load those image in the above-defined resource:
CMFCToolBar::AddToolBarForImageCollection(ID_DUMMY1, ID_DUMMY1);
After this, every menu item with the given command(s) will show the associated image as defined in the dummy toolbar resource(s). You can have as many such toolbar resources as required, and just call the AddToolBarForImageCollection for each one.
Note: Although I have used the same resource ID for both toolbar and bitmap resources, you can also use different IDs. So long as the arguments given in the call to AddToolBarForImageCollection are properly coordinated, the method will still work.
I have a game (Unity3d) that is running on Android where its View is contained in a FrameLayout. The game view covers the entire screen.
I am adding (in code) another view next to this view another button view (the 2 views overlap - see images below).
The button does not receive any input.
According to the documentation for FrameLayout, it is advisable to use a single element under it, but multiple views are also possible.
Why does my button not receive any input?
Attaching the view state as captured in Eclipse.
In my Android project I've already created a custom dialog: A class named SelectColorDialog, extending Dialog, that allows the user to view a large matrix of color cells in order to select a particular color. The dialog returns the selected color value (as Integer) to the dialog initiator – typically an Activity – via a callback function.
I've a similar custom dialog, SelectTypefaceDialog, to allow easy font selection. A list of available typefaces are shown, as ListView rows, each identified by name and with an associated short sample text rendered in that typeface. The available typefaces include usual droid fonts, such as NORMAL, MONOSPACE, etc. as well as any externally sourced TTF font files that the user cares to load into a particular subdirectory on the SDCard.
These custom dialogs were not initially designed to be used directly in conjunction with SharedPreferences, preferences definition XML files or with any PreferenceActivity. Instead of, each dialog can be popped up from any activity, via the user pressing a button or via a menu item. The activity classes that create these dialogs also have internal callback classes, selection event listeners, to detect when the user selects a color or font.
These two dialogs do not have OK and Cancel buttons. Instead, the user just clicks on an item - a view of some kind - in the dialog to select the corresponding color or typeface value (implicit OK) or else presses the device’s back button to dismiss the dialog with no action taken (implicit Cancel).
I would now like to go further and incorporate these two custom dialogs into the shared preferences framework via a preferences.XML and an associated PreferenceActivity.
I would prefer to base two DialogPreference subclasses directly on these existing dialogs if possible, but I cannot see how to do so. I suspect that I cannot, and that I'll need to start all over again, and copy or adapt all the java code that is presently in the custom dialog classes – for color or font display and selection – directly into the custom DialogPreference classes instead, perhaps by overriding onCreateDialogView() and/or other methods?
This question may be a bit old, but I hope to help those, looking at the same problem in future: just extend Preference instead of DialogPreference. DialogPreference is designed badly and expected "official" way to use custom Dialog - overriding protected showDialog method does not work, because this single method contains half of class logic.