Friday, August 16, 2013

Dynamic Tabs

While working on part of a project - I wanted to use tabs, but they had to be generated dynamically. Even though we went with another way to do this I didn't want to lose the code I had found to make the tabs show up dynamically (now, just need to set aside time and figure out more on the TabItem Content)

(I'm going to make a separate post for the styling, since I was fortunate and found some of the templates I needed. I don't want to lose those either)

The actual XAML is only a Grid, with a reference to some data to use to fill out the tabs and a TabControl that contains the TabItems.
For this practice/test/will this ever work trial - I made an observable collection in the codebehind of the control itself.
Afterwards, I managed to come up with a foreach statement that would create and add the tabs to the main TabControl. It does assign a style to the tabs as well - I'm still figuring out the TabContent area. But baby steps :)

Now, time to document the style - and how I finally got into the tabs themselves.

No comments:

Post a Comment