With the new “Create New Database” feature to the RanvenDB Studio we added the option to edit your bundles.
We wanted something that seemed to be quite strait forward: A tab view that we could dynamically choose which tabs a visible and which are not.
At first we tried doing it with the TabControl and bind the header visibility of each TabItem to a property in the model that let us know if this database has that bundle.
This is how I had done it:
At first it seemed to work, however when looking closely we noticed something like this:
As you can see, in the header we only have “Versioning” but the tab we see is the “Quotas Tab”
This happened because we hid the header but the item itself was still the “SelectedItem”.
So we tried to bind the “SelectedItem” as well, but apperantly there is an issue with TabControl and MVVM.
Finally we decided to create our own implementation of Tab View and this is how we did it:
In the Model size we have:
The Bundles Collection is updated with the list of bundles that are active for this database.
One other this we needed to add was to initialize the SelectedBundle to be the first one in the list.
We did that where we initialize the Bundles collection like that: