|
7 | 7 | xmlns:converters="clr-namespace:Rubberduck.UI.Settings.Converters"
|
8 | 8 | mc:Ignorable="d"
|
9 | 9 | Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SourceControl_Branches}"
|
| 10 | + Name="SourceControlBranchesTab" |
10 | 11 | d:DesignHeight="450" d:DesignWidth="300"
|
11 | 12 | d:DataContext="{d:DesignInstance {x:Type sourceControl:BranchesViewViewModel}, IsDesignTimeCreatable=False}">
|
12 | 13 | <TabItem.Resources>
|
|
19 | 20 | <BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
20 | 21 | <converters:SelectedItemToBooleanConverter x:Key="HasSelectedItems"/>
|
21 | 22 |
|
| 23 | + <Style x:Key="PublishedBranchesContextMenu" TargetType="ListBox"> |
| 24 | + <Setter Property="ContextMenu"> |
| 25 | + <Setter.Value> |
| 26 | + <ContextMenu DataContext="{Binding DataContext, Source={x:Reference SourceControlBranchesTab}}"> |
| 27 | + <MenuItem Command="{Binding UnpublishBranchToolbarButtonCommand}" |
| 28 | + CommandParameter="{Binding CurrentPublishedBranch}" |
| 29 | + Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SourceControl_UnpublishBranchButton}"> |
| 30 | + </MenuItem> |
| 31 | + <MenuItem Command="{Binding DeleteBranchToolbarButtonCommand}" |
| 32 | + CommandParameter="True" |
| 33 | + Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SourceControl_DeleteButton}"> |
| 34 | + <MenuItem.Icon> |
| 35 | + <Image Source="{StaticResource DeleteImage}" /> |
| 36 | + </MenuItem.Icon> |
| 37 | + </MenuItem> |
| 38 | + </ContextMenu> |
| 39 | + </Setter.Value> |
| 40 | + </Setter> |
| 41 | + </Style> |
| 42 | + |
| 43 | + <Style x:Key="UnpublishedBranchesContextMenu" TargetType="ListBox"> |
| 44 | + <Setter Property="ContextMenu"> |
| 45 | + <Setter.Value> |
| 46 | + <ContextMenu DataContext="{Binding DataContext, Source={x:Reference SourceControlBranchesTab}}"> |
| 47 | + <MenuItem Command="{Binding PublishBranchToolbarButtonCommand}" |
| 48 | + CommandParameter="{Binding CurrentUnpublishedBranch}" |
| 49 | + Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SourceControl_PublishBranchButton}"> |
| 50 | + </MenuItem> |
| 51 | + <MenuItem Command="{Binding DeleteBranchToolbarButtonCommand}" |
| 52 | + CommandParameter="False" |
| 53 | + Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SourceControl_DeleteButton}"> |
| 54 | + <MenuItem.Icon> |
| 55 | + <Image Source="{StaticResource DeleteImage}" /> |
| 56 | + </MenuItem.Icon> |
| 57 | + </MenuItem> |
| 58 | + </ContextMenu> |
| 59 | + </Setter.Value> |
| 60 | + </Setter> |
| 61 | + </Style> |
| 62 | + |
22 | 63 | <Style x:Key="FocusVisual">
|
23 | 64 | <Setter Property="Control.Template">
|
24 | 65 | <Setter.Value>
|
|
246 | 287 | <ToolBar Style="{DynamicResource ToolBarWithOverflowOnlyShowingWhenNeededStyle}"
|
247 | 288 | Background="Transparent">
|
248 | 289 | <Button Command="{Binding UnpublishBranchToolbarButtonCommand}"
|
249 |
| - CommandParameter="{Binding ElementName=PublishedBranchList, Path=SelectedItem}" |
250 |
| - IsEnabled="{Binding ElementName=PublishedBranchList, Path=SelectedItem, Converter={StaticResource HasSelectedItems}}" |
| 290 | + CommandParameter="{Binding CurrentPublishedBranch}" |
251 | 291 | Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SourceControl_UnpublishBranchButton}"
|
252 | 292 | Height="22" />
|
253 | 293 | <Button Command="{Binding DeleteBranchToolbarButtonCommand}"
|
254 |
| - CommandParameter="{Binding ElementName=PublishedBranchList, Path=SelectedItem}" |
255 |
| - IsEnabled="{Binding ElementName=PublishedBranchList, Path=SelectedItem, Converter={StaticResource HasSelectedItems}}" |
| 294 | + CommandParameter="True" |
256 | 295 | Height="22">
|
257 | 296 | <StackPanel Orientation="Horizontal">
|
258 | 297 | <Image Source="{StaticResource DeleteImage}" />
|
|
263 | 302 | </Button>
|
264 | 303 | </ToolBar>
|
265 | 304 | </ToolBarTray>
|
266 |
| - <ListBox Name="PublishedBranchList" |
267 |
| - Height="175" |
| 305 | + <ListBox Height="175" |
268 | 306 | ItemContainerStyle="{StaticResource PrettyListBoxItem}"
|
269 |
| - ItemsSource="{Binding PublishedBranches}" /> |
| 307 | + ItemsSource="{Binding PublishedBranches}" |
| 308 | + SelectedItem="{Binding CurrentPublishedBranch, Mode=OneWayToSource}" |
| 309 | + Style="{StaticResource PublishedBranchesContextMenu}" /> |
270 | 310 | </DockPanel>
|
271 | 311 | </GroupBox>
|
272 | 312 |
|
|
278 | 318 | <ToolBar Style="{DynamicResource ToolBarWithOverflowOnlyShowingWhenNeededStyle}"
|
279 | 319 | Background="Transparent">
|
280 | 320 | <Button Command="{Binding PublishBranchToolbarButtonCommand}"
|
281 |
| - CommandParameter="{Binding ElementName=UnpublishedBranchList, Path=SelectedItem}" |
282 |
| - IsEnabled="{Binding ElementName=UnpublishedBranchList, Path=SelectedItem, Converter={StaticResource HasSelectedItems}}" |
| 321 | + CommandParameter="{Binding CurrentUnpublishedBranch}" |
283 | 322 | Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SourceControl_PublishBranchButton}"
|
284 | 323 | Height="22" />
|
285 | 324 | <Button Command="{Binding DeleteBranchToolbarButtonCommand}"
|
286 |
| - CommandParameter="{Binding ElementName=UnpublishedBranchList, Path=SelectedItem}" |
287 |
| - IsEnabled="{Binding ElementName=UnpublishedBranchList, Path=SelectedItem, Converter={StaticResource HasSelectedItems}}" |
| 325 | + CommandParameter="False" |
288 | 326 | Height="22">
|
289 | 327 | <StackPanel Orientation="Horizontal">
|
290 | 328 | <Image Source="{StaticResource DeleteImage}" />
|
|
295 | 333 | </Button>
|
296 | 334 | </ToolBar>
|
297 | 335 | </ToolBarTray>
|
298 |
| - <ListBox Name="UnpublishedBranchList" |
299 |
| - Height="175" |
| 336 | + <ListBox Height="175" |
300 | 337 | ItemContainerStyle="{StaticResource PrettyListBoxItem}"
|
301 |
| - ItemsSource="{Binding UnpublishedBranches}" /> |
| 338 | + ItemsSource="{Binding UnpublishedBranches}" |
| 339 | + SelectedItem="{Binding CurrentUnpublishedBranch, Mode=OneWayToSource}" |
| 340 | + Style="{StaticResource UnpublishedBranchesContextMenu}" /> |
302 | 341 | </DockPanel>
|
303 | 342 | </GroupBox>
|
304 | 343 | </StackPanel>
|
|
0 commit comments