|
7 | 7 | xmlns:local="clr-namespace:Rubberduck.UI.AddRemoveReferences"
|
8 | 8 | xmlns:converters="clr-namespace:Rubberduck.UI.Converters"
|
9 | 9 | xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
| 10 | + xmlns:controls="clr-namespace:Rubberduck.UI.Controls" |
10 | 11 | mc:Ignorable="d"
|
11 | 12 | d:DesignHeight="380" d:DesignWidth="600"
|
12 | 13 | d:DataContext="{d:DesignInstance local:AddRemoveReferencesViewModel}">
|
13 | 14 | <UserControl.Resources>
|
14 |
| - <BitmapImage x:Key="SearchIcon" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/magnifier-medium.png" /> |
15 | 15 | <BitmapImage x:Key="BrowseIcon" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/folder-open.png" />
|
16 | 16 | <BitmapImage x:Key="LibraryIcon" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/node-select-all.png" />
|
17 | 17 | <BitmapImage x:Key="VbaProjectIcon" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Custom/PNG/ObjectClass.png" />
|
|
24 | 24 |
|
25 | 25 | <local:ReferenceStatusImageSourceConverter x:Key="StatusToIcon" />
|
26 | 26 | <local:PriorityButtonVisibilityConverter x:Key="PriorityButtonVisibility" />
|
27 |
| - <converters:RemainingWidthConverter x:Key="RemainingWidth" /> |
| 27 | + <local:SearchImageSourceConverter x:Key="SearchToIcon" /> |
| 28 | + <converters:BoolToHiddenVisibilityConverter x:Key="ProjectVisibilityConverter" /> |
28 | 29 |
|
29 | 30 | <Style x:Key="DialogButtonStyle" TargetType="Button">
|
30 | 31 | <Setter Property="Margin" Value="5,0" />
|
|
129 | 130 | <RowDefinition Height="40" />
|
130 | 131 | </Grid.RowDefinitions>
|
131 | 132 | <DockPanel Grid.Row="0" Dock="Top" Background="{x:Static SystemColors.WindowBrush}">
|
132 |
| - <Label DockPanel.Dock="Top" Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=References_Caption}" FontWeight="Bold" /> |
| 133 | + <Label DockPanel.Dock="Top" Content="{Binding ProjectCaption}" FontWeight="Bold" /> |
133 | 134 | <TextBlock DockPanel.Dock="Top" Text="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=References_SubCaption}" Margin="10,0,0,10" />
|
134 | 135 | </DockPanel>
|
135 | 136 | <Border Grid.Row="1" Background="{x:Static SystemColors.ControlLightBrush}">
|
|
149 | 150 | </StackPanel>
|
150 | 151 | </TabItem.Header>
|
151 | 152 | </TabItem>
|
152 |
| - <TabItem Tag="Projects" Visibility="{Binding ProjectsVisible}"> |
| 153 | + <TabItem Tag="Projects" Visibility="{Binding ProjectsHidden, Converter={StaticResource ProjectVisibilityConverter}}"> |
153 | 154 | <TabItem.Header>
|
154 | 155 | <StackPanel Orientation="Horizontal">
|
155 | 156 | <Image Source="{StaticResource VbaProjectIcon}" />
|
|
203 | 204 | <ColumnDefinition Width="*" />
|
204 | 205 | <ColumnDefinition Width="20" />
|
205 | 206 | </Grid.ColumnDefinitions>
|
206 |
| - <TextBox Grid.Column="0"> |
| 207 | + <TextBox Name="SearchBox" Grid.Column="0"> |
207 | 208 | <TextBox.Style>
|
208 | 209 | <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource PlaceHolder}">
|
209 | 210 | <Setter Property="Height" Value="20" />
|
|
213 | 214 | </Style>
|
214 | 215 | </TextBox.Style>
|
215 | 216 | </TextBox>
|
216 |
| - <Border Grid.Column="1" Margin="2" Width="16" Height="16"> |
217 |
| - <Image Source="{StaticResource SearchIcon}" /> |
218 |
| - </Border> |
| 217 | + <Button Name="SearchButton" Grid.Column="1" Command="{Binding ClearSearchCommand}" |
| 218 | + BorderBrush="{x:Static SystemColors.ControlLightBrush}" |
| 219 | + Background="Transparent" |
| 220 | + Width="20" Height="20" Padding="0" Margin="0,1" |
| 221 | + controls:EventFocusAttachment.ElementToFocus="{Binding ElementName=SearchBox}"> |
| 222 | + <Image Margin="2" Width="16" Height="16" |
| 223 | + Source="{Binding Search, Converter={StaticResource SearchToIcon}, UpdateSourceTrigger=PropertyChanged}" /> |
| 224 | + </Button> |
219 | 225 | </Grid>
|
220 | 226 | </Border>
|
221 | 227 | <Border Grid.Row="1" Grid.Column="0">
|
222 |
| - <ListView Name="LibrarySelect" SelectedItem="{Binding SelectedLibrary, Mode=TwoWay}" ItemsSource="{Binding AvailableReferences}" HorizontalContentAlignment="Stretch"> |
| 228 | + <ListView Name="LibrarySelect" SelectedItem="{Binding SelectedLibrary, Mode=TwoWay}" |
| 229 | + SelectionMode="Single" |
| 230 | + ItemsSource="{Binding AvailableReferences}" |
| 231 | + HorizontalContentAlignment="Stretch" |
| 232 | + ScrollViewer.HorizontalScrollBarVisibility="Hidden"> |
223 | 233 | <ListView.ItemContainerStyle>
|
224 | 234 | <Style TargetType="ListViewItem">
|
225 | 235 | <Setter Property="Height" Value="20" />
|
|
230 | 240 | <Grid>
|
231 | 241 | <Grid.ColumnDefinitions>
|
232 | 242 | <ColumnDefinition Width="20" />
|
233 |
| - <ColumnDefinition Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}, Converter={StaticResource RemainingWidth}}" /> |
| 243 | + <ColumnDefinition Width="*" /> |
234 | 244 | <ColumnDefinition Width="50" />
|
235 | 245 | </Grid.ColumnDefinitions>
|
236 | 246 | <Button Grid.Column="0"
|
237 | 247 | Width="16" Height="16"
|
238 | 248 | Background="Transparent"
|
239 | 249 | BorderBrush="Transparent"
|
240 | 250 | Command="{Binding DataContext.PinLibraryCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:AddRemoveReferencesWindow}}}">
|
| 251 | + <i:Interaction.Behaviors> |
| 252 | + <controls:BindableListItemDrillThroughBehavior /> |
| 253 | + </i:Interaction.Behaviors> |
241 | 254 | <Image Source="{Binding Status, Converter={StaticResource StatusToIcon}}" />
|
242 | 255 | </Button>
|
243 |
| - <TextBlock Grid.Column="1" Text="{Binding Description}" Margin="2,0"> |
| 256 | + <TextBlock Grid.Column="1" Text="{Binding Description}" Margin="2,0" TextTrimming="CharacterEllipsis"> |
| 257 | + <i:Interaction.Behaviors> |
| 258 | + <controls:BindableListItemDrillThroughBehavior /> |
| 259 | + </i:Interaction.Behaviors> |
244 | 260 | <TextBlock.InputBindings>
|
245 | 261 | <MouseBinding MouseAction="LeftDoubleClick"
|
246 | 262 | Command="{Binding DataContext.AddCommand, UpdateSourceTrigger=PropertyChanged, ElementName=LibrarySelect}" />
|
|
261 | 277 | </Button>
|
262 | 278 | </StackPanel>
|
263 | 279 | <Border Grid.Row="1" Grid.Column="2">
|
264 |
| - <ListView Name="ProjectSelect" SelectedItem="{Binding SelectedReference, Mode=TwoWay}" ItemsSource="{Binding ProjectReferences}" HorizontalContentAlignment="Stretch"> |
| 280 | + <ListView Name="ProjectSelect" |
| 281 | + SelectedItem="{Binding SelectedReference, Mode=TwoWay}" |
| 282 | + SelectionMode="Single" |
| 283 | + ItemsSource="{Binding ProjectReferences, NotifyOnTargetUpdated=True}" |
| 284 | + ScrollViewer.HorizontalScrollBarVisibility="Hidden" |
| 285 | + HorizontalContentAlignment="Stretch"> |
265 | 286 | <ListView.ItemContainerStyle>
|
266 | 287 | <Style TargetType="ListViewItem">
|
267 | 288 | <Setter Property="Height" Value="20" />
|
|
272 | 293 | <Grid>
|
273 | 294 | <Grid.ColumnDefinitions>
|
274 | 295 | <ColumnDefinition Width="20" />
|
275 |
| - <ColumnDefinition Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}, Converter={StaticResource RemainingWidth}}" /> |
| 296 | + <ColumnDefinition Width="*" /> |
276 | 297 | <ColumnDefinition Width="50" />
|
277 | 298 | <ColumnDefinition Width="20" />
|
278 | 299 | <ColumnDefinition Width="20" />
|
|
283 | 304 | BorderBrush="Transparent"
|
284 | 305 | Command="{Binding DataContext.PinReferenceCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:AddRemoveReferencesWindow}}}">
|
285 | 306 | <Image Source="{Binding Status, Converter={StaticResource StatusToIcon}}" />
|
| 307 | + <i:Interaction.Behaviors> |
| 308 | + <controls:BindableListItemDrillThroughBehavior /> |
| 309 | + </i:Interaction.Behaviors> |
286 | 310 | </Button>
|
287 |
| - <TextBlock Grid.Column="1" Text="{Binding Description}" Margin="2,0"> |
| 311 | + <TextBlock Grid.Column="1" Text="{Binding Description}" Margin="2,0" TextTrimming="CharacterEllipsis"> |
| 312 | + <i:Interaction.Behaviors> |
| 313 | + <controls:BindableListItemDrillThroughBehavior /> |
| 314 | + </i:Interaction.Behaviors> |
288 | 315 | <TextBlock.InputBindings>
|
289 | 316 | <MouseBinding MouseAction="LeftDoubleClick"
|
290 | 317 | Command="{Binding DataContext.RemoveCommand, UpdateSourceTrigger=PropertyChanged, ElementName=ProjectSelect}" />
|
|
0 commit comments