|
6 | 6 | xmlns:codeMetrics="clr-namespace:Rubberduck.CodeAnalysis.CodeMetrics" |
7 | 7 | xmlns:controls="clr-namespace:Rubberduck.UI.Controls" |
8 | 8 | xmlns:converters="clr-namespace:Rubberduck.UI.Converters" |
| 9 | + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" |
9 | 10 | ResxExtension.DefaultResxName="Rubberduck.Resources.RubberduckUI" |
10 | 11 | Language="{UICulture}" |
11 | 12 | Name="CodeMetrics" |
|
151 | 152 | </LinearGradientBrush> |
152 | 153 | <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" /> |
153 | 154 | <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" /> |
| 155 | + |
| 156 | + <Style x:Key="ShinyTreeView" |
| 157 | + TargetType="{x:Type TreeViewItem}"> |
| 158 | + <Setter Property="BorderThickness" Value="1.5"/> |
| 159 | + <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/> |
| 160 | + <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" /> |
| 161 | + <Setter Property="Visibility" Value="{Binding IsVisible, Mode=OneWay, Converter={StaticResource BoolToVisibility}}" /> |
| 162 | + <Setter Property="HorizontalAlignment" Value="Left" /> |
| 163 | + <Style.Triggers> |
| 164 | + <Trigger Property="IsSelected" Value="True"> |
| 165 | + <Setter Property="BorderBrush" Value="#adc6e5"/> |
| 166 | + </Trigger> |
| 167 | + <MultiTrigger> |
| 168 | + <MultiTrigger.Conditions> |
| 169 | + <Condition Property="IsSelected" Value="True"/> |
| 170 | + <Condition Property="IsSelectionActive" Value="False"/> |
| 171 | + </MultiTrigger.Conditions> |
| 172 | + <Setter Property="BorderBrush" Value="LightGray"/> |
| 173 | + </MultiTrigger> |
| 174 | + </Style.Triggers> |
| 175 | + <Style.Resources> |
| 176 | + <Style TargetType="Border"> |
| 177 | + <Setter Property="CornerRadius" Value="2"/> |
| 178 | + </Style> |
| 179 | + </Style.Resources> |
| 180 | + </Style> |
| 181 | + |
| 182 | + <Style x:Key="IconStyle" TargetType="Image"> |
| 183 | + <Setter Property="Height" Value="16" /> |
| 184 | + <Setter Property="Width" Value="16" /> |
| 185 | + <Setter Property="Margin" Value="2,0,2,0" /> |
| 186 | + <Setter Property="VerticalAlignment" Value="Top" /> |
| 187 | + </Style> |
| 188 | + |
| 189 | + <Style x:Key="TreeViewItemStyle" TargetType="TextBlock"> |
| 190 | + <Setter Property="Text" Value="{Binding Name}" /> |
| 191 | + <Setter Property="FontSize" Value="10" /> |
| 192 | + <Setter Property="Margin" Value="2,0,2,0" /> |
| 193 | + <Setter Property="VerticalAlignment" Value="Center" /> |
| 194 | + <Setter Property="ToolTip" Value="{Binding Name}" /> |
| 195 | + <Setter Property="ToolTipService.InitialShowDelay" Value="500" /> |
| 196 | + <Setter Property="TextTrimming" Value="CharacterEllipsis" /> |
| 197 | + </Style> |
| 198 | + |
| 199 | + <Style x:Key="TreeViewItemStyleWithSignatures" TargetType="TextBlock"> |
| 200 | + <Setter Property="Text" Value="{Binding NameWithSignature}" /> |
| 201 | + <Setter Property="FontSize" Value="10" /> |
| 202 | + <Setter Property="Margin" Value="2,0,2,0" /> |
| 203 | + <Setter Property="VerticalAlignment" Value="Center" /> |
| 204 | + <Setter Property="ToolTip" Value="{Binding NameWithSignature}" /> |
| 205 | + <Setter Property="ToolTipService.InitialShowDelay" Value="500" /> |
| 206 | + <Setter Property="TextTrimming" Value="CharacterEllipsis" /> |
| 207 | + </Style> |
| 208 | + |
| 209 | + <Style x:Key="TreeViewIconStyle" TargetType="Image" BasedOn="{StaticResource IconStyle}"> |
| 210 | + <Setter Property="Source" Value="{Binding CollapsedIcon}" /> |
| 211 | + <Style.Triggers> |
| 212 | + <!-- thanks to H.B. on http://stackoverflow.com/a/5797323/1188513 --> |
| 213 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TreeViewItem}, Path=IsExpanded}" Value="True"> |
| 214 | + <Setter Property="Source" Value="{Binding ExpandedIcon}" /> |
| 215 | + </DataTrigger> |
| 216 | + </Style.Triggers> |
| 217 | + </Style> |
| 218 | + |
| 219 | + <HierarchicalDataTemplate x:Key="CodeExplorerTemplate" |
| 220 | + DataType="codeExplorer:CodeExplorerProjectViewModel" |
| 221 | + ItemsSource="{Binding Items}"> |
| 222 | + <StackPanel Orientation="Horizontal"> |
| 223 | + <Image Style="{StaticResource TreeViewIconStyle}" /> |
| 224 | + <TextBlock Style="{StaticResource TreeViewItemStyle}" Visibility="{Binding ElementName=DisplaySignatures, Path=IsChecked, Converter={StaticResource BoolToHiddenVisibility}}" /> |
| 225 | + <TextBlock Style="{StaticResource TreeViewItemStyleWithSignatures}" Visibility="{Binding ElementName=DisplaySignatures, Path=IsChecked, Converter={StaticResource BoolToVisibility}}" /> |
| 226 | + </StackPanel> |
| 227 | + </HierarchicalDataTemplate> |
| 228 | + |
| 229 | + <Style x:Key="CodeExplorerTreeViewStyle" TargetType="TreeView"> |
| 230 | + <Setter Property="ItemTemplate" Value="{StaticResource CodeExplorerTemplate}" /> |
| 231 | + <Setter Property="ItemsSource" Value="{Binding Projects, UpdateSourceTrigger=PropertyChanged}" /> |
| 232 | + </Style> |
154 | 233 | </ResourceDictionary> |
155 | 234 | </UserControl.Resources> |
156 | 235 |
|
|
164 | 243 | <RowDefinition Height="*" /> |
165 | 244 | </Grid.RowDefinitions> |
166 | 245 |
|
167 | | - <ListBox Name="ListBox" |
168 | | - Grid.RowSpan="2" |
169 | | - Grid.Column="0" |
170 | | - ItemContainerStyle="{StaticResource PrettyListBoxItem}" |
171 | | - ItemsSource="{Binding ModuleMetrics}" |
172 | | - DisplayMemberPath="ModuleName" |
173 | | - SelectedItem="{Binding SelectedMetric, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
174 | | - Margin="5,5,0,5" /> |
175 | | - |
176 | | - <WrapPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="0"> |
177 | | - <StackPanel Orientation="Horizontal"> |
178 | | - <Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeMetrics_Lines}" FontWeight="Bold" /> |
179 | | - <TextBlock Text="{Binding SelectedMetric.Result.Lines}" VerticalAlignment="Center" /> |
180 | | - </StackPanel> |
181 | | - <StackPanel Orientation="Horizontal"> |
182 | | - <Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeMetrics_Complexity}" FontWeight="Bold" /> |
183 | | - <TextBlock Text="{Binding SelectedMetric.Result.CyclomaticComplexity}" VerticalAlignment="Center" /> |
184 | | - </StackPanel> |
185 | | - <StackPanel Orientation="Horizontal"> |
186 | | - <Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeMetrics_Nesting}" FontWeight="Bold" /> |
187 | | - <TextBlock Text="{Binding SelectedMetric.Result.MaximumNesting}" VerticalAlignment="Center" /> |
188 | | - </StackPanel> |
189 | | - </WrapPanel> |
190 | | - |
191 | | - <DataGrid Grid.Column="1" |
192 | | - Grid.Row="1" |
193 | | - ItemsSource="{Binding SelectedMetric.MemberResults}" |
194 | | - AutoGenerateColumns="False" |
195 | | - IsReadOnly="True" |
196 | | - CanUserReorderColumns="False" |
197 | | - CanUserSortColumns="True" |
198 | | - CanUserAddRows="False" |
199 | | - CanUserDeleteRows="False" |
200 | | - CanUserResizeColumns="True" |
201 | | - CanUserResizeRows="False" |
202 | | - HorizontalGridLinesBrush="Transparent" |
203 | | - VerticalGridLinesBrush="Transparent" |
204 | | - HeadersVisibility="Column" |
205 | | - HorizontalScrollBarVisibility="Disabled" |
206 | | - ItemContainerStyle="{StaticResource PrettifyRow}" |
207 | | - ColumnHeaderHeight="22" |
208 | | - SelectionMode="Single" |
209 | | - Margin="5,5,0,5"> |
210 | | - <DataGrid.CellStyle> |
211 | | - <Style TargetType="{x:Type DataGridCell}"> |
212 | | - <Setter Property="BorderThickness" Value="0" /> |
213 | | - <Setter Property="Background" Value="Transparent" /> |
214 | | - <Setter Property="Padding" Value="0" /> |
215 | | - <Setter Property="VerticalContentAlignment" Value="Stretch" /> |
216 | | - <Setter Property="VerticalAlignment" Value="Center" /> |
217 | | - </Style> |
218 | | - </DataGrid.CellStyle> |
219 | | - <DataGrid.Columns> |
220 | | - <DataGridTextColumn Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=SearchResults_MemberName}" Binding="{Binding Path=Key, Mode=OneWay, Converter={StaticResource DeclarationToMemberSignatureConverter}}" Width="*"/> |
221 | | - <DataGridTextColumn Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeMetrics_Lines}" Binding="{Binding Path=Value.Lines, Mode=OneWay}" Width="auto"/> |
222 | | - <DataGridTextColumn Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeMetrics_Complexity}" Binding="{Binding Path=Value.CyclomaticComplexity, Mode=OneWay}" Width="auto"/> |
223 | | - <DataGridTextColumn Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=CodeMetrics_Nesting}" Binding="{Binding Path=Value.MaximumNesting, Mode=OneWay}" Width="auto"/> |
224 | | - </DataGrid.Columns> |
225 | | - </DataGrid> |
| 246 | + <TreeView x:Name="ProjectTree" |
| 247 | + Grid.Column="0" |
| 248 | + Grid.RowSpan="2" |
| 249 | + Background="White" |
| 250 | + ItemContainerStyle="{StaticResource ShinyTreeView}" |
| 251 | + HorizontalContentAlignment="Stretch" |
| 252 | + Style="{StaticResource CodeExplorerTreeViewStyle}" BorderThickness="0,1" |
| 253 | + VirtualizingPanel.IsVirtualizing="False" |
| 254 | + Visibility="{Binding Path=TreeViewVisibility}"> |
| 255 | + <i:Interaction.Behaviors> |
| 256 | + <controls:BindableSelectedItemBehavior SelectedItem="{Binding SelectedItem, Mode=TwoWay}" /> |
| 257 | + </i:Interaction.Behaviors> |
| 258 | + </TreeView> |
| 259 | + |
| 260 | + <ListView ItemsSource="{Binding Metrics}" Grid.Column="1" Grid.Row="1"> |
| 261 | + <ListView.ItemTemplate> |
| 262 | + <DataTemplate> |
| 263 | + <StackPanel Orientation="Horizontal"> |
| 264 | + <Label Content="{Binding Metric.Name}" FontWeight="Bold" /> |
| 265 | + <TextBlock Text="{Binding Value}" VerticalAlignment="Center" /> |
| 266 | + </StackPanel> |
| 267 | + </DataTemplate> |
| 268 | + </ListView.ItemTemplate> |
| 269 | + </ListView> |
226 | 270 |
|
227 | 271 | <controls:EmptyUIRefresh Grid.ColumnSpan="2" Grid.RowSpan="2" Visibility="{Binding EmptyUIRefreshMessageVisibility, Mode=OneWay, Converter={StaticResource BoolToVisibility}}" /> |
228 | 272 | <controls:BusyIndicator Grid.ColumnSpan="2" Grid.RowSpan="2" Width="120" Height="120" Visibility="{Binding IsBusy, Mode=OneWay, Converter={StaticResource BoolToVisibility}}" /> |
|
0 commit comments