Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddOn with Two Tabs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    AddOn with Two Tabs

    Hello,

    I have an Addon with 2 tabs called App and Settings. Each tab has its own class called AppFrameworkTab and SettingsFrameworkTab.

    In the Settings tab I have a combo box with 3 items defined from the XAML file. If I am in the SettingsFrameworkTab code, I can access the selected item of the combo box with comboBox.SelectedItem.

    My question is, can I access the combo box defined in the SettingsFrameworkTab code from the AppFrameworkTab code?

    Thank you.

    #2
    Hello,

    Thank you for the question.

    For both separate classes to see the same object or information, they would need to somehow share that object.

    If you are loading a string as xaml and then getting items from the xaml that was parsed, you may be able to assign the found objects to a static classes property. Both classes could then access that static class to check if the object is null or not or get values.

    Another option may be to pass an instance of an object to each tab from where they are created to create a shared object between the tabs. On the change event this object could then be updated with a new value.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you Jesse. I am able to create a class object from the App tab to Settings tab and get its information, but if the info in the Settings tab is changed, I will have to pass an object in the event update as you suggested to get the updated information.

      I also tried to save data to the Workspace for the Settings tab, but was unable to retrieve these settings from the App tab as it looks to me that the Workspace saves settings using a GUID for each tab which is only accessible from the tab that created it. Is that correct or is there a way to access Workspace settings from a tab other than the one that created it?

      Comment


        #4
        Hello,

        By default there would not be any specific way for the two separate tab classes to communicate, this would highly depend on how you want to make that connection.

        Passing the same object to both classes should work for allowing both classes to see the same data, but as you said there is no update event to notify when one changes. You would need to implement a notification in whatever way would work with your logic, that could be an exposed method, custom event subscription, MVVM pattern. It would really depend on how you want to make it.

        In the case you are using bindings or data contexts, I would likely suggest reviewing INotifyPropertyChanged to see if when the Property changes the bound controls are notified. If you are not and just assigning values to objects, an exposed method to "update" or apply new values when called could be used.

        If you have a sample of the two tabs and class you have passed to both, we could review that sample to see what specifically may work in that situation.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by funk10101, Today, 09:43 PM
        0 responses
        3 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        36 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        26 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Working...
        X