I am new to WPF app development and I have a problem to update a list in one user control from another user Control.Basically I have a MainWindow in which I have two user control for which one contains a list and another user control contains an excel Import .I have to update the List user control from the excel Import user control .I could successfully read all excel content in a list but how could I pass those list to List user control
Related
I'm using a gallery to display a list of names I've selected inside the gallery I've inserted a combobox with a bunch of work task codes, this is being saved into a local collection.Gallery with combobox
when I close the app and re-open it the combobox that is beside each name no longer shows the assigned task code.
I have tried placing the task codes in both the DefaultSelectedItems and Items but can not seem to figure out how to retain the selected code once I reopen the app.
I have a save button with the following Clear(Myteam); ForAll(Gallery_team.AllItems, Collect(Myteam,{Position:ComboBox_position.Selected.Value})); SaveData(Myteam "Savedteam")
The use of SaveData is to locally make a save-file of the current state of your collection. It's local, on the device, and not saved somewhere on-prem/cloud related.
If you want to get your SavedDta back into your app, you need to use LoadData first, otherwise the data will stay outside.
For your application, its more wisely to patch it to, for example, a SharePoint list or an excel sheet.
I have a tabpage which displays a summary of records in my database, when the user clicks a row a new tabpage opens, this uses a form as a 'template' which has textboxes, the textboxes will display the detailed data from the specific row.
The stumbling point I am at is I can get to the point where the new tabpage opens with the form template displayed but I dont know how to fill the textboxes on the new tabpage / form with the data from the database (based on the row the user selected). How do I reference the textboxes on the new tabpage and assign them the appropriate fields? Do I bind the 'templates' textboxes and then fill them with a query?
I have tried this...
Me.tabMain.TabPages(NewTab).Controls(frmRecipeDisplay.Controls(txtVersion).Text = "test")
But this causes an error.
This app is in VB.NET.
Any help is appreciated.
(PyGTK 2.24.2 with 32-bit Python 2.7.11.)
How do I populate a ComboBox dynamically when the down-arrow is clicked? I want the box to list the Windows COM ports (retrieved via win32file.QueryDosDevice) that exist at the moment it is clicked.
Create a callback function related to the "popdown" gtk.ComboBox Signal where you remove all texts in the connected liststore and add the new ones.
Definition (in your screen design, right after creating the combo):
self.combobox.connect ( 'popdown', self.callback )
Callback (best located in a separate part of the code):
def callback(self, combobox, user_param1, ...)
See http://www.pygtk.org/pygtk2reference/class-gtkcombobox.html#signal-gtkcombobox--popdown
How can I reset my viewmodel when the user clicks new button on the view that has the viewmodel as it's datacontext?
For example:
If I have a view NewCustomer and upon save, the data is saved to the DB and the newly created account number is displayed. But when the user clicks the New button in the screen, I want the view (viewmodel) to be reinitialized. Or if the user clicked cancel in the screen to clear all changes.
How can I achieve this? I am using Prism 5.0 and Unity as my container.
If I used IRegionMemberLifetime, I can clear the viewmodel data when I navigate away and navigate again to the view (by setting the KeepAlive as false on clicking New button before navigating away). But I want the form to be cleared without navigating. Can this be done?
You could have a screen/workspaceViewModel, and another ViewModel wrapping your data.
So two classes: CarScreenViewModel and CarViewModel.
The CarScreenViewModel would have a property, say CurrentCar, which reflects what is currently selected in the screen. Then, when clicking the Create button, you simply set:
CurrentCar = new CarViewModel();
Resetting partially loaded data will only lead to behaviour that is hard to reproduce. It is better to start with a fresh instance.
Your standard approach will be something like below
ViewModels
CustomersContainerViewModel which contains
a collection of CustomerViewModel s
and ICommands like
CreateNewCustomer
DeleteExistingCustomer
UpdateExistingCustomer
Your View will contain
the CustomersContainerView which will contain
a collection of Customer Objects in your required UI element
a button to Create new customer (which will launch a new screen which contains the newCustomer fields it can also contain cancel, which will just close the form)
a button to delete (can also be a ContextMenu)
a button to update (can also be a ContextMenu) which will launch a customer form filled with details from DB.
Hopefully this makes some sense... Let me know if you have problem with any of the above
Update - Forgot to add. NewCustomer Command will add a new Customer object to your CustomerCollection and that should open a NewCustomer form (or whatever you chose) for user to input the customer details. Cancel/Delete will just remove that record from the collection. Delete will update the DB as well in addition
In my case
yourViewName.variableName.postValue("")
Hi,
I'm new to both Prism and WPF, and I have a question regarding sharing data between views.
Application I'm working on resembles SQL Server Development Studio. Demo contains two regions. First region contains tree (like Object explorer in SQL Server DS). Tree nodes are bound to different view models. Example would be DatabaseA->Tables->dbo.TableA->Columns etc.
Second region is initially empty. When I double click on tree node I would like to open view that displays data I clicked in tree.
In detail:
1. double click on tree node
2. node data and display it in second region
3. if second region isn't empty, check if clicked node data is already displayed in one of existing tab pages
4. if not, create new tab page with clicked node data, otherwise focus existing tab page
Until now, I managed to created tree. When tree node is clicked app calls:
UriQuery uriQuery = new UriQuery {{"ID", unit.Id.ToString()}};
uriQuery.Add("TypeName", "Unit");
var uri = new Uri("DebugTreeItemView" + uriQuery, UriKind.Relative);
RegionManager.RequestNavigate("SECOND_REGION", uri);
This will open view with tab control and I can fetch uri parameters. But I'm not satisfied with this solution. I need a way to:
1. intercept this RegionManager.RequestNavigate call in order to check if tab control is alread created. Also, I need to check that clicked node data isn't already displayed in one of existing tab pages.
2. I would like to send Unit object directly to tab control view instead of sending ID and typename. What is the best way to achieve this?
Thanks.
I would have a ShellViewModel controlling my overall application. It would contain the TreeNode collection for the left side, and the OpenTabs collection for the right side. It would also contain the SelectedTabIndex for the right side, and perhaps the SelectedTreeNode for the left side if it made sense to do so.
When you want to open a new Tab, I would use the EventAggregator to publish an OpenTab event and pass it the selected TreeNode item. The ShellViewModel would subscribe to those events, and would determine if that object already existed in the OpenTabs collection. If it exists, it simply sets the SelectedTabIndex. If not, it adds the item to the OpenTabs collection before setting the SelectedTabIndex
A while back I posted something here on this sort of navigation with MVVM if you're interested