![]() ![]() UpdateParametersCommand = new Rela圜ommand(CallUpdateParameters) _testParameter.CollectionChanged += _testParameter_CollectionChanged _testParameter.ItemPropert圜hanged += _testParameter_ItemPropert圜hanged Public ViewModelParameterPane(ExternalEvent e圎vent, HandlerED handler, UIApplication uiapp) Public TestObservableCollection TestParameter Private TestObservableCollection _testParameter = new TestObservableCollection() I originally was using a in a to present different cell types, but even using a basic Ĭ# ViewModel public class ViewModelParameterPane : ViewModelBase Each time an item in the ObservableCollection is updated it makes the change subscribes it to INPC and raises the collection changed event.įor each of the columns I have the binding set to Mode="TwoWay" and have tried setting the UpdateSourceTrigger="Propert圜hanged", and neither helped. I had to create a custom ObservableCollection to implement INPC for the items in the collection, and from debugging it appears to work as intended. Am I missing something with this? How do I get the DataGrid to update without having to completely clear and reset the ObservableCollection items? I can't seem to find a way to keep with MVVM principles and force the cells to redraw with their updated value. Once you minimize the window, click into the cell, or scroll the DataGrid to where the cell is not visible the cell will show the new value when it comes back into view. Once the collection changed event is complete the wrapped parameter value matches the parameter value from the API, but the DataGrid will not redraw the information. The issue currently lies in the very last step. The DataGrid updates it's values to complete the process.The ObservableCollection fires off it's collection changed event to notify the DataGrid that values have changed. ![]() The ViewModel checks each parameter to see if its value has changed, and updates any of the wrapped parameters in the ObservableCollection to reflect the changes.The calculated parameter values are changed in the model.The change is made and the internal logic of the element calculates it's values based on the changed parameter.When the cell loses focus it fires off a command that hooks the API and updates the parameter's value. The user then changes a value in the DataGrid.The addin uses the API to pull the parameters and wraps them in a wrapper class and adds them into a custom ObservableCollection to display them in the DataGrid.The issue I am running into lies in the workflow. The complication is that because I am working with an API I can only use what tools I am given when interacting with the model. This is a filtered list that are specific to my organization and our users needs, and allow the user to edit them in order to streamline their workflow. The overarching goal is to create a window that shows the parameters of a 3D element after it is selected. I am working in C# and am using WPF and MVVM for the UI for an addin for Revit (a 3D modeling software from Autodesk). I will try to keep this as brief as possible, but there is a fair amount of nuance to this question. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |