Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit bf1a56c

Browse files
committed
Add [None] item in view model.
Instead of using a behavior to add/remove the [None] item in the pull request list view, use the new listener collection to add/remove it.
1 parent fdaace8 commit bf1a56c

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

src/GitHub.App/ViewModels/PullRequestListViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public PullRequestListViewModel(IRepositoryHost repositoryHost, ISimpleRepositor
7373
trackingAuthors.Subscribe();
7474
trackingAssignees.Subscribe();
7575

76-
Authors = trackingAuthors.CreateListenerCollection(new List<IAccount> { EmptyUser });
77-
Assignees = trackingAssignees.CreateListenerCollection(new List<IAccount> { EmptyUser });
76+
Authors = trackingAuthors.CreateListenerCollection(EmptyUser, this.WhenAnyValue(x => x.SelectedAuthor));
77+
Assignees = trackingAssignees.CreateListenerCollection(EmptyUser, this.WhenAnyValue(x => x.SelectedAssignee));
7878

7979
PullRequests = new TrackingCollection<IPullRequestModel>();
8080
pullRequests.Comparer = OrderedComparer<IPullRequestModel>.OrderByDescending(x => x.UpdatedAt).Compare;

src/GitHub.VisualStudio/UI/Views/PullRequestListView.xaml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,9 @@
163163

164164
<ListBox x:Name="assignees"
165165
DockPanel.Dock="Top"
166+
ItemsSource="{Binding Assignees}"
166167
SelectedItem="{Binding SelectedAssignee}"
167168
Style="{DynamicResource GitHubPopupThing}">
168-
<ListBox.ItemsSource>
169-
<MultiBinding Converter="{ui:StickieListItemConverter}">
170-
<Binding Path="EmptyUser" />
171-
<Binding Path="Assignees" />
172-
</MultiBinding>
173-
</ListBox.ItemsSource>
174-
<i:Interaction.Behaviors>
175-
<ui:AddEmptyItemToList />
176-
</i:Interaction.Behaviors>
177169
<i:Interaction.Triggers>
178170
<i:EventTrigger EventName="SelectionChanged">
179171
<ui:ClosePopupAction TargetName="assigneePopup" />
@@ -212,17 +204,9 @@
212204

213205
<ListBox x:Name="authors"
214206
DockPanel.Dock="Top"
207+
ItemsSource="{Binding Authors}"
215208
SelectedItem="{Binding SelectedAuthor}"
216209
Style="{DynamicResource GitHubPopupThing}">
217-
<ListBox.ItemsSource>
218-
<MultiBinding Converter="{ui:StickieListItemConverter}">
219-
<Binding Path="EmptyUser" />
220-
<Binding Path="Authors" />
221-
</MultiBinding>
222-
</ListBox.ItemsSource>
223-
<i:Interaction.Behaviors>
224-
<ui:AddEmptyItemToList />
225-
</i:Interaction.Behaviors>
226210
<i:Interaction.Triggers>
227211
<i:EventTrigger EventName="SelectionChanged">
228212
<ui:ClosePopupAction TargetName="authorPopup" />

0 commit comments

Comments
 (0)