Dynamic menu items in WPF - wpf

Is there a way to create a section on a menu for a list of menu items to be populated by something like an ObservableCollection?
I'd like to replicate the Window functionality in Visual Studio, where the open document tabs are listed in a numbered list, limited to the first 10.

See "Merge ContextMenus" from here. You can find more info by searching for CompositeCollection and menu/ContextMenu.
EDIT: Just saw CompositeCollection was already mentioned in a comment, but I'm going to leave this here for reference.

How does your menu get data right now? Is it databound? Check this article for binding your menu with a collection.
Now it is up to you to add logics when to add item to the collection.
For eg: In your scenario, you have to store the open documents in a list. Then you have to filter out the first 10 documents and add it to the children property of the MenuItem class specified in the article.

You can create menu items in code and manually add them to the menu when the form loads. It isn't elegant, but it gets the job done.

Related

Get Listview sub items in UI Path

How to get the list view sub items using UI Path RPA.
I tried using data scraping, recording but it output only first sub item data.
I have followed this link regarding same problem but I couldn't understand the xaml file provided in answer.
https://forum.uipath.com/t/data-scraping-listview/118929/10
you could use the "Find children" activity on the parent element, so you could retrieve all the list elements.
You should search for "FIND_DESCENDANTS".
Regards, Gio
If your target client is Windows Forms Ap,you can refer the following:
You must use ui explorer to watch the element attribute
uiexplorer's "UI Frameworks" (from menu options/UI Frameworks) change to "UI Automation".
indicate element to select which subitem you want.
Then you can see down right selector editor display like
"<uia automationid='ListViewSubItem-2' tableCol='2' tableRow='10' />". Watch the left side "visual tree", it show the subitem list. so now what you have to do is to get the item list(it show first subitem) and for each item to get subitem list,finally through get attribute activity to get the subitem value.
the pseudo flow like following:
find_children activity=>for_each activity { find_children activity=> for_each activity { get_attribute activity} }
the first find_children's selector like "<uia automationid='1000' cls='SysListView32' />" and filter is like "<uia automationid='ListViewItem-*'/>".
the second find_children's selector is for_each item and filter is like "<uia automationid='ListViewSubItem-1'/>". the "1" is subitem index.

2sxc Dnn.. Add existing content items to module

I have a view of entities which are being displayed based on an entity type filter. I now need to reorder these and would like to use the built in 2sxc functionality to do this, so I have a created a new view of the data using the "module data source" so that the ordering will work.
But how do I now make all of the existing entities of the same type (definition) appear in this new view? The view now displays one item by default and I can replace that one item. But how do I add multiple existing items? I need the Entity ID's to remain the same for Query String usage and SEO.
Thanks, hope the question makes sense.
Cheers
I believe that you are asking "how can I add many items to an instance (module) manually, so that I can also sort them manually" - is this correct?
If yes, then you must make sure your template supports lists (checkbox in the template settings). This then gives you a [+] button; but you don't want to use that, as it would be for typing in new data. There's another button called "add an empty demo entry" which you'll see as a round (+) after pressing the more ... button once. Pressing this will give you empty entries, into which you can then replace existing items.

Adding a button to the end of the grouped gridview

I am looking into adding a button to the "end" of the grid view.
The idea is that I have a grouped view showing groups and items with in these groups. I only show some of the items within the group and wants to show a "load more" button at the end of the items shown.
I have tried all kinds of things in the standard grouped items page with no luck.
Any good ideas?
Thanks in advance
Kim
The simplest answer is to follow the approach used by most existing apps: Allow the user to click on the header to display all the items.
You can also add the "Load More" button as if it was a normal grid item. Then, style it differently using a different template and ItemTemplateSelector.
Finally, the most complex (and flexible) solution would be to put the "Load More" button above the GridView, and manually sync its location when the GridView is scrolled...

silverlight combobox - highlight a few items in the popup list

I'm wondering if I can make fake sections in the popup menu:
The rule would be, if the 5th character of the displayed item is different from the 5th char of the previous item in the menu, it has to be highlighted
What do you think?
Thanks!
To achieve this would be a hack.
Normally the items that appear in the popup part of a combo box will be an instantiated data template, and each gets its own data item and has no clue or knowledge of the other items in the list, so you couldn't use a converter or anything else to achieve this behavior.
What you could do though is inject (attach) your own control into the popup part of the combo box, and take over the rendering of the data items. How you do this will depend upon which combo box you are using (i.e. MS or some other vendor's) and would be a whole new question.
Would that be easier if I were to create my own combobox as follow:
a TextBox associated with a Button that when pushed would popup a datagrid in which I could implement this conditional formatting?

Binding a combobox to a database and gridview

I am displaying a database table on a grid view and displaying a selected item's details in a detailsview.
Here's the problem:
There's a combobox in the detailsview and I want to display the added value's string on grid and I want the combobox to select this value.
It will be possible to update, delete the selected item from grid or add a new item. And I couldn't do the transformations of string- comboboxitem-database item. And I am quite confused on the binding operations. I hope my question is clear enough. Thanks in advance for any help.
One solution that may preserve your sanity. Only allow edits in your detailsView. Use the grid to Add (clicking an Add Link which shows the detailsView) or Delete. Is it really necessary for the user to be able to edit in either place?

Resources