Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
To simplify:
I use a WPF GUI wich has a button and a listbox.
When the button is clicked i want to execute an ExternalEvent first and after that also update listbox items.
Problem:
For some reason the listbox items get updated first, only after that the ExternalEvent is executed.
This is the relevant part of my code:
private void CreateViewFilters_Click(object sender, RoutedEventArgs e)
{
// 1st part. Gets executed second
// Creates new view filters
CreateViewFilterEvent.Raise();
// 2nd part. Gets executed first
// Revit command wich returns a list of all available view filters inside a revit document
GetExistingViewFiltersCommand getExistingViewFiltersCommand = new GetExistingViewFiltersCommand();
(Result resultCreateViewFilterCommand, List<string> revitViewFilterList) = getExistingViewFiltersCommand.GetExistingViewFiltersMethod(commandData, ref message, elements);
// New list that contains all available view filters
List<string> listBoxValues = new List<string>();
foreach (string rvf in revitViewFilterList)
{
string modifiedRvf = rvf.Replace("_", "__");
listBoxValues.Add(modifiedRvf);
}
// Values from list "listBoxValues" are now updated and will be displayed in the listbox of the wpf gui
SelectFilters.ItemsSource = listBoxValues;
}
I have found a forum post wich seems to describe the same problem (not 100% sure)
Frankly i have not understood the solution there.
Could anyone point me in the right direction or offer a solution, or maybe I am completely wrong in my approach?
Solved! Go to Solution.
Developer Advocacy and Support +