Message 1 of 2

Not applicable
01-06-2018
11:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working on a family-browser project. I have written a code where I'm binding the family property with the UI. I've used the Modeless dialog but I don't want to raise m_exEvent.Raise() in any event, instead, I want to run the m_exEvent.Raise() from an external class.
Here's how I'm currently calling the m_exEvent.Raise() method but when I run the script it does not run the Execute() method that is associated with the Raise(), instead, it skips the method and starts the program from next line of code. Please help, how I can run the m_exEvent.Raise() successfully from another class. Thank you.
public class DirectoryItemViewModel { public ObservableCollection<FamilyType> _subfamilies; public ObservableCollection<FamilyType> SubFamilies { get { if (_subfamilies != null) return _subfamilies; if (Type == DirectoryItemType.File) { //Here's how I'm calling the Raise() UserControls.DefaultControl.Instance.Execute(); } return SubFamilies; } set { if (_subfamilies == null) { _subfamilies = value; //OnPropertyChanged("SubFamilies"); } } } } public partial class DefaultControl : UserControl { public static DefaultControl Instance = null; public ExternalEvent m_ExEvent; public ExternalRevitFileSelecter m_Handler; public DefaultControl(ExternalEvent exEvent, ExternalRevitFileSelecter handler) { Instance = this; InitializeComponent(); this.DataContext = new DirectoryStructureViewModel(); this.m_ExEvent = exEvent; this.m_Handler = handler; } public void Execute() { m_ExEvent.Raise(); } }
Solved! Go to Solution.