Hibernating Rhinos

Zero friction databases

Dynamic Tab View In Silverlight

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:

clip_image002

At first it seemed to work, however when looking closely we noticed something like this:

clip_image004

clip_image006

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:

clip_image008

In the Model size we have:

clip_image010

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:

clip_image012

Comments

Thomas Freudenberg
08/24/2012 06:11 AM by
Thomas Freudenberg

All the bundles are hard-coded? I would have expected they are discovered at runtime.

Ayende Rahien
08/24/2012 12:07 PM by
Ayende Rahien

Thomas, Yes, they are. They aren't discoverable, because you need to add specific UI and code path to handle their configuration

Comments have been closed on this topic.