-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bind TerminalPage's TabView to TerminalPage::_tabs #3922
Comments
(minor warning callout to @mkitzan as well: he requested this on a recent code review, and we're officially booking team work on it. 😄) |
I'm yanking triage and scoping it into 1912. 😄 |
## Summary of the Pull Request This PR will make the existing `Tab` class into a WinRT type. This will allow any XAML to simply bind to the `ObservableVector` of Tabs. This PR will be followed up with a future PR to change our TabView to use the ObservableVector, which will in turn eliminate the need for maintaining two vectors of Tabs. (We currently maintain `_tabs` in `TerminalPage` and we also maintain `TabView().TabViewItems()` at the same time as described here: #2740) ## References #3922 ## PR Checklist * [x] CLA signed. * [x] Tests added/passed ## Detailed Description of the Pull Request / Additional comments I've currently only exposed a Tab's Title and IconPath to keep things simple. I foresee XAML elements that bind to Tabs to only really need these two properties for displaying. I've also converted `TerminalPage`'s `std::vector<std::shared_ptr> _tabs` into a `IObservableVector<winrt::TerminalPage::Tab> _tabs` just so that future PRs will have the ground set for binding to this vector of tabs. ## Validation Steps Performed Played around with Tabs and Panes and all sorts of combinations of keybindings for interacting with tabs and dragging and whatnot, it all seemed fine! Tab Tests also all pass.
Tab
into a WinRT class TerminalPage
's TabView
to TerminalPage::_tabs
TerminalPage
's TabView
to TerminalPage::_tabs
Closing because we actually need access to the TabViewItem to perform some of our custom modifications like tab color and tab title boxes (and maybe future modifications), and so letting us have total control of our TabViewItems is needed, so this in fact is the way |
Currently,
Tab
is a regular C++ class. This gives us some annoying headaches when trying to tieTab
s to the UI. For example, as described in #2740,TerminalPage
keeps track of two separate vectors ofTab
that need to be kept in sync. There's one vector ofTabViewItems
specifically used by theTabView
and another vector of<shared_ptr<Tab>>
. Updating one requires an update on the other one.This could be avoided by using an observable vector of
Tab
that's bound to the XAML control. However, this requiresTab
to be converted to a WinRT class. This would also make future attempts to useTab
in XAML controls much easier. (such as in #1502)EDIT: as of #4350,
Tab
has been converted into a WinRT type, andTerminalPage::_tabs
has been converted to anIObservableVector
. What's left is to bindTerminalPage
's TabView to that vector.The text was updated successfully, but these errors were encountered: