Browse Source

Use DataGrid in all metadata views.

pull/1716/head
Siegfried Pammer 6 years ago
parent
commit
bd9291f65b
  1. 31
      ILSpy/Commands/DecompileCommand.cs
  2. 52
      ILSpy/ContextMenuEntry.cs
  3. 112
      ILSpy/Controls/FilterableGridViewColumn.cs
  4. 21
      ILSpy/ILSpy.csproj
  5. 4
      ILSpy/Metadata/CorTables/AssemblyRefTableTreeNode.cs
  6. 5
      ILSpy/Metadata/CorTables/AssemblyTableTreeNode.cs
  7. 2
      ILSpy/Metadata/CorTables/ConstantTableTreeNode.cs
  8. 2
      ILSpy/Metadata/CorTables/CustomAttributeTableTreeNode.cs
  9. 2
      ILSpy/Metadata/CorTables/DeclSecurityTableTreeNode.cs
  10. 2
      ILSpy/Metadata/CorTables/EventTableTreeNode.cs
  11. 4
      ILSpy/Metadata/CorTables/ExportedTypeTableTreeNode.cs
  12. 2
      ILSpy/Metadata/CorTables/FieldLayoutTableTreeNode.cs
  13. 2
      ILSpy/Metadata/CorTables/FieldTableTreeNode.cs
  14. 2
      ILSpy/Metadata/CorTables/FileTableTreeNode.cs
  15. 2
      ILSpy/Metadata/CorTables/GenericParamConstraintTableTreeNode.cs
  16. 2
      ILSpy/Metadata/CorTables/GenericParamTableTreeNode.cs
  17. 2
      ILSpy/Metadata/CorTables/ManifestResourceTableTreeNode.cs
  18. 2
      ILSpy/Metadata/CorTables/MemberRefTableTreeNode.cs
  19. 2
      ILSpy/Metadata/CorTables/MethodImplTableTreeNode.cs
  20. 2
      ILSpy/Metadata/CorTables/MethodSemanticsTableTreeNode.cs
  21. 2
      ILSpy/Metadata/CorTables/MethodSpecTableTreeNode.cs
  22. 33
      ILSpy/Metadata/CorTables/MethodTableTreeNode.cs
  23. 2
      ILSpy/Metadata/CorTables/ModuleRefTableTreeNode.cs
  24. 2
      ILSpy/Metadata/CorTables/ModuleTableTreeNode.cs
  25. 2
      ILSpy/Metadata/CorTables/ParamTableTreeNode.cs
  26. 2
      ILSpy/Metadata/CorTables/PropertyTableTreeNode.cs
  27. 2
      ILSpy/Metadata/CorTables/StandAloneSigTableTreeNode.cs
  28. 2
      ILSpy/Metadata/CorTables/TypeDefTableTreeNode.cs
  29. 3
      ILSpy/Metadata/CorTables/TypeRefTableTreeNode.cs
  30. 2
      ILSpy/Metadata/CorTables/TypeSpecTableTreeNode.cs
  31. 17
      ILSpy/Metadata/DataDirectoriesTreeNode.cs
  32. 38
      ILSpy/Metadata/DataGridCustomTextColumn.cs
  33. 2
      ILSpy/Metadata/DosHeaderTreeNode.cs
  34. 122
      ILSpy/Metadata/EntityHandleTemplate.cs
  35. 36
      ILSpy/Metadata/FlagsFilterControl.xaml
  36. 115
      ILSpy/Metadata/FlagsFilterControl.xaml.cs
  37. 24
      ILSpy/Metadata/FlagsTooltip.xaml
  38. 66
      ILSpy/Metadata/FlagsTooltip.xaml.cs
  39. 125
      ILSpy/Metadata/Helpers.cs
  40. 32
      ILSpy/Metadata/HexFilterControl.xaml
  41. 84
      ILSpy/Metadata/HexFilterControl.xaml.cs
  42. 694
      ILSpy/Metadata/MetadataTableViews.xaml
  43. 93
      ILSpy/Metadata/StringHandleTemplate.cs
  44. 39
      ILSpy/themes/generic.xaml

31
ILSpy/Commands/DecompileCommand.cs

@ -24,10 +24,6 @@ namespace ICSharpCode.ILSpy.Commands @@ -24,10 +24,6 @@ namespace ICSharpCode.ILSpy.Commands
public bool IsVisible(TextViewContext context)
{
var (c, selectedItem) = context.GetColumnAndRowFromMousePosition();
if (c is FilterableGridViewColumn column && column.CellTemplateSelector is HandleTemplate && selectedItem is IMemberTreeNode) {
var selectedHandle = MetadataTokens.EntityHandle((int)selectedItem.GetType().GetProperty(column.SortBy).GetValue(selectedItem));
return !selectedHandle.IsNil && (selectedHandle.Kind == HandleKind.TypeDefinition || selectedHandle.Kind == HandleKind.FieldDefinition || selectedHandle.Kind == HandleKind.MethodDefinition || selectedHandle.Kind == HandleKind.PropertyDefinition || selectedHandle.Kind == HandleKind.EventDefinition);
}
if (context.SelectedTreeNodes == null)
return context.Reference?.Reference is IEntity;
return context.SelectedTreeNodes.Length == 1 && context.SelectedTreeNodes.All(n => n is IMemberTreeNode);
@ -36,10 +32,6 @@ namespace ICSharpCode.ILSpy.Commands @@ -36,10 +32,6 @@ namespace ICSharpCode.ILSpy.Commands
public bool IsEnabled(TextViewContext context)
{
var (c, selectedItem) = context.GetColumnAndRowFromMousePosition();
if (c is FilterableGridViewColumn column && column.CellTemplateSelector is HandleTemplate && selectedItem is IMemberTreeNode) {
var selectedHandle = MetadataTokens.EntityHandle((int)selectedItem.GetType().GetProperty(column.SortBy).GetValue(selectedItem));
return !selectedHandle.IsNil && (selectedHandle.Kind == HandleKind.TypeDefinition || selectedHandle.Kind == HandleKind.FieldDefinition || selectedHandle.Kind == HandleKind.MethodDefinition || selectedHandle.Kind == HandleKind.PropertyDefinition || selectedHandle.Kind == HandleKind.EventDefinition);
}
if (context.SelectedTreeNodes == null)
return context.Reference?.Reference is IEntity;
foreach (IMemberTreeNode node in context.SelectedTreeNodes) {
@ -58,28 +50,7 @@ namespace ICSharpCode.ILSpy.Commands @@ -58,28 +50,7 @@ namespace ICSharpCode.ILSpy.Commands
public void Execute(TextViewContext context)
{
IEntity selection = null;
var (c, selectedItem) = context.GetColumnAndRowFromMousePosition();
if (c is FilterableGridViewColumn column && column.CellTemplateSelector is HandleTemplate && selectedItem is IMemberTreeNode semanticContext) {
var selectedHandle = MetadataTokens.EntityHandle((int)selectedItem.GetType().GetProperty(column.SortBy).GetValue(selectedItem));
var module = (MetadataModule)semanticContext.Member.ParentModule;
switch (selectedHandle.Kind) {
case HandleKind.TypeDefinition:
selection = module.GetDefinition((TypeDefinitionHandle)selectedHandle);
break;
case HandleKind.FieldDefinition:
selection = module.GetDefinition((FieldDefinitionHandle)selectedHandle);
break;
case HandleKind.MethodDefinition:
selection = module.GetDefinition((MethodDefinitionHandle)selectedHandle);
break;
case HandleKind.PropertyDefinition:
selection = module.GetDefinition((PropertyDefinitionHandle)selectedHandle);
break;
case HandleKind.EventDefinition:
selection = module.GetDefinition((EventDefinitionHandle)selectedHandle);
break;
}
} else if (context.SelectedTreeNodes?[0] is IMemberTreeNode node) {
if (context.SelectedTreeNodes?[0] is IMemberTreeNode node) {
selection = node.Member;
} else if (context.Reference?.Reference is IEntity entity) {
selection = entity;

52
ILSpy/ContextMenuEntry.cs

@ -55,13 +55,19 @@ namespace ICSharpCode.ILSpy @@ -55,13 +55,19 @@ namespace ICSharpCode.ILSpy
/// Returns null, if context menu is not assigned to a text view.
/// </summary>
public DecompilerTextView TextView { get; private set; }
/// <summary>
/// Returns the list box the context menu is assigned to.
/// Returns null, if context menu is not assigned to a list box.
/// </summary>
public ListBox ListBox { get; private set; }
/// <summary>
/// Returns the data grid the context menu is assigned to.
/// Returns null, if context menu is not assigned to a data grid.
/// </summary>
public DataGrid DataGrid { get; private set; }
/// <summary>
/// Returns the reference the mouse cursor is currently hovering above.
/// Returns null, if there was no reference found.
@ -110,7 +116,7 @@ namespace ICSharpCode.ILSpy @@ -110,7 +116,7 @@ namespace ICSharpCode.ILSpy
}
}
public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null, ListBox listBox = null)
public static TextViewContext Create(SharpTreeView treeView = null, DecompilerTextView textView = null, ListBox listBox = null, DataGrid dataGrid = null)
{
ReferenceSegment reference;
if (textView != null)
@ -121,18 +127,23 @@ namespace ICSharpCode.ILSpy @@ -121,18 +127,23 @@ namespace ICSharpCode.ILSpy
reference = new ReferenceSegment { Reference = provider.Member };
else if (listBox?.SelectedItem != null)
reference = new ReferenceSegment { Reference = listBox.SelectedItem };
else if (dataGrid?.SelectedItem is TreeNodes.IMemberTreeNode provider2)
reference = new ReferenceSegment { Reference = provider2.Member };
else if (dataGrid?.SelectedItem != null)
reference = new ReferenceSegment { Reference = dataGrid.SelectedItem };
else
reference = null;
var position = textView != null ? textView.GetPositionFromMousePosition() : null;
var selectedTreeNodes = treeView != null ? treeView.GetTopLevelSelection().ToArray() : null;
return new TextViewContext {
ListBox = listBox,
DataGrid = dataGrid,
TreeView = treeView,
SelectedTreeNodes = selectedTreeNodes,
TextView = textView,
Reference = reference,
Position = position,
MousePosition = ((Visual)textView ?? treeView ?? listBox).PointToScreen(Mouse.GetPosition((IInputElement)textView ?? treeView ?? listBox))
MousePosition = ((Visual)textView ?? treeView ?? (Visual)listBox ?? dataGrid).PointToScreen(Mouse.GetPosition((IInputElement)textView ?? treeView ?? (IInputElement)listBox ?? dataGrid))
};
}
}
@ -187,17 +198,25 @@ namespace ICSharpCode.ILSpy @@ -187,17 +198,25 @@ namespace ICSharpCode.ILSpy
// ContextMenuOpening event handler is called.
textView.ContextMenu = new ContextMenu();
}
public static void Add(ListBox listBox)
{
var provider = new ContextMenuProvider(listBox);
listBox.ContextMenuOpening += provider.listBox_ContextMenuOpening;
listBox.ContextMenu = new ContextMenu();
}
public static void Add(DataGrid dataGrid)
{
var provider = new ContextMenuProvider(dataGrid);
dataGrid.ContextMenuOpening += provider.dataGrid_ContextMenuOpening;
dataGrid.ContextMenu = new ContextMenu();
}
readonly SharpTreeView treeView;
readonly DecompilerTextView textView;
readonly ListBox listBox;
readonly DataGrid dataGrid;
readonly Lazy<IContextMenuEntry, IContextMenuEntryMetadata>[] entries;
private ContextMenuProvider()
@ -223,6 +242,12 @@ namespace ICSharpCode.ILSpy @@ -223,6 +242,12 @@ namespace ICSharpCode.ILSpy
this.listBox = listBox ?? throw new ArgumentNullException(nameof(listBox));
}
ContextMenuProvider(DataGrid dataGrid)
: this()
{
this.dataGrid = dataGrid ?? throw new ArgumentNullException(nameof(dataGrid));
}
void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
TextViewContext context = TextViewContext.Create(treeView);
@ -259,7 +284,18 @@ namespace ICSharpCode.ILSpy @@ -259,7 +284,18 @@ namespace ICSharpCode.ILSpy
// hide the context menu.
e.Handled = true;
}
void dataGrid_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{
TextViewContext context = TextViewContext.Create(dataGrid: dataGrid);
ContextMenu menu;
if (ShowContextMenu(context, out menu))
dataGrid.ContextMenu = menu;
else
// hide the context menu.
e.Handled = true;
}
bool ShowContextMenu(TextViewContext context, out ContextMenu menu)
{
menu = new ContextMenu();
@ -273,7 +309,7 @@ namespace ICSharpCode.ILSpy @@ -273,7 +309,7 @@ namespace ICSharpCode.ILSpy
needSeparatorForCategory = false;
}
MenuItem menuItem = new MenuItem();
menuItem.Header = MainWindow.GetResourceString( entryPair.Metadata.Header);
menuItem.Header = MainWindow.GetResourceString(entryPair.Metadata.Header);
menuItem.InputGestureText = entryPair.Metadata.InputGestureText;
if (!string.IsNullOrEmpty(entryPair.Metadata.Icon)) {
menuItem.Icon = new Image {

112
ILSpy/Controls/FilterableGridViewColumn.cs

@ -1,112 +0,0 @@ @@ -1,112 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
namespace ICSharpCode.ILSpy.Controls
{
class FilterableGridViewColumn : SortableGridViewColumn
{
static readonly ComponentResourceKey headerTemplateKey = new ComponentResourceKey(typeof(FilterableGridViewColumn), "ColumnHeaderTemplate");
public FilterableGridViewColumn()
{
this.SetValueToExtension(HeaderTemplateProperty, new DynamicResourceExtension(headerTemplateKey));
}
string filterBy;
public string FilterBy {
get { return filterBy; }
set {
if (filterBy != value) {
filterBy = value;
OnPropertyChanged(new PropertyChangedEventArgs("FilterBy"));
}
}
}
string filterFormatString;
public string FilterFormatString {
get { return filterFormatString; }
set {
if (filterFormatString != value) {
filterFormatString = value;
OnPropertyChanged(new PropertyChangedEventArgs("FilterFormatString"));
}
}
}
public static ListView GetParentView(DependencyObject obj)
{
return (ListView)obj.GetValue(ParentViewProperty);
}
public static void SetParentView(DependencyObject obj, ListView value)
{
obj.SetValue(ParentViewProperty, value);
}
public static readonly DependencyProperty ParentViewProperty =
DependencyProperty.RegisterAttached("ParentView", typeof(ListView), typeof(FilterableGridViewColumn), new PropertyMetadata(null));
public string FilterExpression {
get { return (string)GetValue(FilterExpressionProperty); }
set { SetValue(FilterExpressionProperty, value); }
}
public static readonly DependencyProperty FilterExpressionProperty =
DependencyProperty.Register("FilterExpression", typeof(string), typeof(FilterableGridViewColumn), new PropertyMetadata(null, OnFilterExpressionChanged));
private static void OnFilterExpressionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var header = d as FilterableGridViewColumn;
var view = GetParentView(header);
if (header == null || view == null)
return;
header.Filter(view, e.NewValue as string);
}
void Filter(ListView grid, string filterExpression)
{
ColumnSortDirection currentDirection = GetSortDirection(grid);
ICollectionView dataView = CollectionViewSource.GetDefaultView(grid.ItemsSource);
if (dataView == null) return;
string filterBy = FilterBy;
if (filterBy == null) {
Binding binding = DisplayMemberBinding as Binding;
if (binding != null && binding.Path != null) {
filterBy = binding.Path.Path;
}
}
dataView.Filter = delegate (object item) {
if (filterBy == null)
return true;
var pInfo = item.GetType().GetProperty(filterBy);
if (pInfo == null)
return false;
return Matches(filterExpression, string.Format("{0:" + FilterFormatString + "}", pInfo.GetValue(item)));
};
dataView.Refresh();
}
bool Matches(string filterExpression, string value)
{
return value?.Contains(filterExpression) == true;
}
}
}

21
ILSpy/ILSpy.csproj

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>WinExe</OutputType>
<LangVersion>7.2</LangVersion>
<LangVersion>7.3</LangVersion>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<GenerateSupportedRuntime>false</GenerateSupportedRuntime>
@ -124,7 +124,6 @@ @@ -124,7 +124,6 @@
<Compile Include="Controls\CustomDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\FilterableGridViewColumn.cs" />
<Compile Include="Controls\GridViewColumnAutoSize.cs" />
<Compile Include="Controls\MarkupExtensions.cs" />
<Compile Include="Controls\ResourceObjectTable.xaml.cs">
@ -136,6 +135,10 @@ @@ -136,6 +135,10 @@
<Compile Include="Controls\SearchBox.cs" />
<Compile Include="Controls\SortableGridViewColumn.cs" />
<Compile Include="Controls\XamlResourceExtension.cs" />
<Compile Include="Metadata\DataGridCustomTextColumn.cs" />
<Compile Include="Metadata\FlagsFilterControl.xaml.cs" />
<Compile Include="Metadata\FlagsTooltip.xaml.cs" />
<Compile Include="Metadata\HexFilterControl.xaml.cs" />
<Compile Include="ViewModels\ManageAssemblyListsViewModel.cs" />
<Compile Include="ViewModels\ViewModelBase.cs" />
<Compile Include="Views\CreateListDialog.xaml.cs">
@ -300,9 +303,7 @@ @@ -300,9 +303,7 @@
<Compile Include="Metadata\DataDirectoriesTreeNode.cs" />
<Compile Include="Metadata\DosHeaderTreeNode.cs" />
<Compile Include="Metadata\CoffHeaderTreeNode.cs" />
<Compile Include="Metadata\EntityHandleTemplate.cs" />
<Compile Include="Metadata\Helpers.cs" />
<Compile Include="Metadata\StringHandleTemplate.cs" />
<Compile Include="Metadata\MetadataTableViews.xaml.cs" />
<Compile Include="Metadata\MetadataTreeNode.cs" />
<Compile Include="Metadata\OptionalHeaderTreeNode.cs" />
@ -440,6 +441,9 @@ @@ -440,6 +441,9 @@
<Page Include="Controls\ResourceObjectTable.xaml" />
<Page Include="Controls\ResourceStringTable.xaml" />
<Page Include="Controls\SearchBoxStyle.xaml" />
<Page Include="Metadata\FlagsFilterControl.xaml" />
<Page Include="Metadata\FlagsTooltip.xaml" />
<Page Include="Metadata\HexFilterControl.xaml" />
<Page Include="Views\CreateListDialog.xaml" />
<Page Include="Views\DebugSteps.xaml" />
<Page Include="Images\Assembly.xaml" />
@ -520,6 +524,15 @@ @@ -520,6 +524,15 @@
<ItemGroup>
<Page Update="@(Page)" SubType="Designer" Generator="MSBuild:Compile" />
<Page Update="Metadata\FlagsFilterControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Metadata\FlagsTooltip.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Metadata\HexFilterControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Metadata\MetadataTableViews.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>

4
ILSpy/Metadata/CorTables/AssemblyRefTableTreeNode.cs

@ -46,10 +46,8 @@ namespace ICSharpCode.ILSpy.Metadata @@ -46,10 +46,8 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("AssemblyRefView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<AssemblyRefEntry>();
foreach (var row in metadata.AssemblyReferences) {

5
ILSpy/Metadata/CorTables/AssemblyTableTreeNode.cs

@ -53,10 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -53,10 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("AssemblyView");
var metadata = module.Metadata;
var view = Helpers.PrepareDataGrid(tabPage);
var list = new List<AssemblyEntry>();
list.Add(new AssemblyEntry(module));

2
ILSpy/Metadata/CorTables/ConstantTableTreeNode.cs

@ -48,7 +48,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -48,7 +48,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("ConstantsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<ConstantEntry>();

2
ILSpy/Metadata/CorTables/CustomAttributeTableTreeNode.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("CustomAttributesView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<CustomAttributeEntry>();

2
ILSpy/Metadata/CorTables/DeclSecurityTableTreeNode.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("DeclSecurityAttrsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<DeclSecurityEntry>();

2
ILSpy/Metadata/CorTables/EventTableTreeNode.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("EventDefsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<EventDefEntry>();

4
ILSpy/Metadata/CorTables/ExportedTypeTableTreeNode.cs

@ -53,10 +53,8 @@ namespace ICSharpCode.ILSpy.Metadata @@ -53,10 +53,8 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("ExportedTypesView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<ExportedTypeEntry>();
foreach (var row in metadata.ExportedTypes) {

2
ILSpy/Metadata/CorTables/FieldLayoutTableTreeNode.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("FieldLayoutsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<FieldLayoutEntry>();

2
ILSpy/Metadata/CorTables/FieldTableTreeNode.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("FieldDefsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<FieldDefEntry>();

2
ILSpy/Metadata/CorTables/FileTableTreeNode.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("FilesView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<FileEntry>();

2
ILSpy/Metadata/CorTables/GenericParamConstraintTableTreeNode.cs

@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("GenericParamConstraintsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<GenericParamConstraintEntry>();

2
ILSpy/Metadata/CorTables/GenericParamTableTreeNode.cs

@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("GenericParamsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<GenericParamEntry>();

2
ILSpy/Metadata/CorTables/ManifestResourceTableTreeNode.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("ManifestResourcesView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<ManifestResourceEntry>();

2
ILSpy/Metadata/CorTables/MemberRefTableTreeNode.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("MemberRefsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<MemberRefEntry>();

2
ILSpy/Metadata/CorTables/MethodImplTableTreeNode.cs

@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("MethodImplView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<MethodImplEntry>();

2
ILSpy/Metadata/CorTables/MethodSemanticsTableTreeNode.cs

@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("MethodSemanticsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<MethodSemanticsEntry>();

2
ILSpy/Metadata/CorTables/MethodSpecTableTreeNode.cs

@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("MethodSpecsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<MethodSpecEntry>();

33
ILSpy/Metadata/CorTables/MethodTableTreeNode.cs

@ -31,6 +31,8 @@ using ICSharpCode.Decompiler.Metadata; @@ -31,6 +31,8 @@ using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpy.TreeNodes;
using System.Diagnostics;
using System.Reflection;
namespace ICSharpCode.ILSpy.Metadata
{
@ -52,9 +54,8 @@ namespace ICSharpCode.ILSpy.Metadata @@ -52,9 +54,8 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("MethodDefsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<MethodDefEntry>();
foreach (var row in metadata.MethodDefinitions)
@ -82,27 +83,38 @@ namespace ICSharpCode.ILSpy.Metadata @@ -82,27 +83,38 @@ namespace ICSharpCode.ILSpy.Metadata
+ metadata.GetTableMetadataOffset(TableIndex.MethodDef)
+ metadata.GetTableRowSize(TableIndex.MethodDef) * (RID - 1);
public int Attributes => (int)methodDef.Attributes;
public MethodAttributes Attributes => methodDef.Attributes;
public object AttributesTooltip => new FlagsTooltip((int)methodDef.Attributes, typeof(MethodAttributes));
public string AttributesTooltip => null; //Helpers.AttributesToString(MethodDef.Attributes);
public MethodImplAttributes ImplAttributes => methodDef.ImplAttributes;
public int NameStringHandle => MetadataTokens.GetHeapOffset(methodDef.Name);
public object ImplAttributesTooltip => new FlagsTooltip((int)methodDef.ImplAttributes, typeof(MethodImplAttributes));
public int RVA => methodDef.RelativeVirtualAddress;
public string Name => metadata.GetString(methodDef.Name);
IEntity IMemberTreeNode.Member => ((MetadataModule)module.GetTypeSystemOrNull()?.MainModule).GetDefinition(handle);
public string NameTooltip => $"{MetadataTokens.GetHeapOffset(methodDef.Name):X} \"{Name}\"";
public int Signature => MetadataTokens.GetHeapOffset(methodDef.Signature);
string signatureTooltip;
public string SignatureTooltip {
get {
ITextOutput output = new PlainTextOutput();
var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module);
((EntityHandle)handle).WriteTo(module, output, context);
return output.ToString();
if (signatureTooltip == null) {
ITextOutput output = new PlainTextOutput();
var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module);
((EntityHandle)handle).WriteTo(module, output, context);
signatureTooltip = output.ToString();
}
return signatureTooltip;
}
}
IEntity IMemberTreeNode.Member => ((MetadataModule)module.GetTypeSystemOrNull()?.MainModule).GetDefinition(handle);
public MethodDefEntry(PEFile module, MethodDefinitionHandle handle)
{
this.metadataOffset = module.Reader.PEHeaders.MetadataStartOffset;
@ -110,6 +122,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -110,6 +122,7 @@ namespace ICSharpCode.ILSpy.Metadata
this.metadata = module.Metadata;
this.handle = handle;
this.methodDef = metadata.GetMethodDefinition(handle);
this.signatureTooltip = null;
}
}

2
ILSpy/Metadata/CorTables/ModuleRefTableTreeNode.cs

@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("ModuleRefsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<ModuleRefEntry>();

2
ILSpy/Metadata/CorTables/ModuleTableTreeNode.cs

@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("ModulesView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<ModuleEntry>();

2
ILSpy/Metadata/CorTables/ParamTableTreeNode.cs

@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("ParamsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<ParamEntry>();

2
ILSpy/Metadata/CorTables/PropertyTableTreeNode.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("PropertyDefsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<PropertyDefEntry>();

2
ILSpy/Metadata/CorTables/StandAloneSigTableTreeNode.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("StandAloneSigsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<StandAloneSigEntry>();

2
ILSpy/Metadata/CorTables/TypeDefTableTreeNode.cs

@ -56,7 +56,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -56,7 +56,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("TypeDefsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<TypeDefEntry>();

3
ILSpy/Metadata/CorTables/TypeRefTableTreeNode.cs

@ -54,8 +54,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -54,8 +54,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("TypeRefsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<TypeRefEntry>();

2
ILSpy/Metadata/CorTables/TypeSpecTableTreeNode.cs

@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
ListView view = Helpers.CreateListView("TypeSpecsView");
var view = Helpers.PrepareDataGrid(tabPage);
var metadata = module.Metadata;
var list = new List<TypeSpecEntry>();

17
ILSpy/Metadata/DataDirectoriesTreeNode.cs

@ -44,17 +44,12 @@ namespace ICSharpCode.ILSpy.Metadata @@ -44,17 +44,12 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
var dataGrid = new DataGrid {
Columns = {
new DataGridTextColumn { IsReadOnly = true, Header = "Name", Binding = new Binding("Name") },
new DataGridTextColumn { IsReadOnly = true, Header = "RVA", Binding = new Binding("RVA") { StringFormat = "X8" } },
new DataGridTextColumn { IsReadOnly = true, Header = "Size", Binding = new Binding("Size") { StringFormat = "X8" } },
new DataGridTextColumn { IsReadOnly = true, Header = "Section", Binding = new Binding("Section") },
},
AutoGenerateColumns = false,
CanUserAddRows = false,
CanUserDeleteRows = false,
};
var dataGrid = Helpers.PrepareDataGrid(tabPage);
//dataGrid.AutoGenerateColumns = false;
//dataGrid.Columns.Add(new DataGridTextColumn { IsReadOnly = true, Header = "Name", Binding = new Binding("Name") });
//dataGrid.Columns.Add(new DataGridTextColumn { IsReadOnly = true, Header = "RVA", Binding = new Binding("RVA") { StringFormat = "X8" } });
//dataGrid.Columns.Add(new DataGridTextColumn { IsReadOnly = true, Header = "Size", Binding = new Binding("Size") { StringFormat = "X8" } });
//dataGrid.Columns.Add(new DataGridTextColumn { IsReadOnly = true, Header = "Section", Binding = new Binding("Section") });
var headers = module.Reader.PEHeaders;
var reader = module.Reader.GetEntireImage().GetReader(headers.PEHeaderStartOffset, 128);
var header = headers.PEHeader;

38
ILSpy/Metadata/DataGridCustomTextColumn.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
namespace ICSharpCode.ILSpy.Metadata
{
class DataGridCustomTextColumn : DataGridTextColumn
{
public BindingBase ToolTipBinding { get; set; }
protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
{
TextBox textBox = new TextBox() { Style = (Style)MetadataTableViews.Instance["DataGridCustomTextColumnTextBoxStyle"] };
BindingOperations.SetBinding(textBox, TextBox.TextProperty, Binding);
BindingOperations.SetBinding(textBox, TextBox.ToolTipProperty, ToolTipBinding);
return textBox;
}
}
}

2
ILSpy/Metadata/DosHeaderTreeNode.cs

@ -44,7 +44,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -44,7 +44,7 @@ namespace ICSharpCode.ILSpy.Metadata
tabPage.Title = Text.ToString();
tabPage.SupportsLanguageSwitching = false;
var view = Helpers.CreateListView("EntryView");
var view = Helpers.PrepareDataGrid(tabPage);
var reader = module.Reader.GetEntireImage().GetReader(0, 64);
var entries = new List<Entry>();

122
ILSpy/Metadata/EntityHandleTemplate.cs

@ -1,122 +0,0 @@ @@ -1,122 +0,0 @@
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace ICSharpCode.ILSpy.Metadata
{
public class HandleTemplate : DataTemplateSelector
{
public string ValueStringFormat { get; set; } = "X8";
public string ValuePropertyName { get; set; }
public string TooltipPropertyName { get; set; }
private DataTemplate template;
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
if (template != null)
return template;
var textBlock = new FrameworkElementFactory(typeof(TextBlock), "textBlock");
textBlock.SetValue(FrameworkElement.MarginProperty, new Thickness(3, 1, 0, 0));
textBlock.SetBinding(TextBlock.TextProperty, new Binding(ValuePropertyName) { StringFormat = ValueStringFormat });
var textBox = new FrameworkElementFactory(typeof(TextBox), "textBox");
textBox.SetBinding(TextBox.TextProperty, new Binding(ValuePropertyName) { StringFormat = ValueStringFormat, Mode = BindingMode.OneWay });
textBox.SetValue(TextBox.VisibilityProperty, Visibility.Hidden);
textBox.SetValue(TextBox.IsReadOnlyCaretVisibleProperty, true);
textBox.SetValue(TextBox.IsReadOnlyProperty, true);
if (TooltipPropertyName != null)
textBox.SetBinding(FrameworkElement.ToolTipProperty, new Binding(TooltipPropertyName));
var grid = new FrameworkElementFactory(typeof(Grid));
grid.AppendChild(textBlock);
grid.AppendChild(textBox);
template = new DataTemplate {
VisualTree = grid,
Triggers = {
new Trigger {
Property = UIElement.IsMouseOverProperty,
Value = true,
Setters = {
new Setter(UIElement.VisibilityProperty, Visibility.Visible, "textBox"),
new Setter(UIElement.VisibilityProperty, Visibility.Hidden, "textBlock"),
}
},
new Trigger {
Property = UIElement.IsKeyboardFocusWithinProperty,
Value = true,
Setters = {
new Setter(UIElement.VisibilityProperty, Visibility.Visible, "textBox"),
new Setter(UIElement.VisibilityProperty, Visibility.Hidden, "textBlock"),
}
}
}
};
return template;
}
}
public class EnumTemplate : DataTemplateSelector
{
public string ValuePropertyName { get; set; }
public string TooltipPropertyName { get; set; }
private DataTemplate template;
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
if (template != null)
return template;
var textBlock = new FrameworkElementFactory(typeof(TextBlock), "textBlock");
textBlock.SetValue(FrameworkElement.MarginProperty, new Thickness(3, 1, 0, 0));
textBlock.SetBinding(TextBlock.TextProperty, new Binding(ValuePropertyName));
var textBox = new FrameworkElementFactory(typeof(TextBox), "textBox");
textBox.SetBinding(TextBox.TextProperty, new Binding(ValuePropertyName) { Mode = BindingMode.OneWay });
textBox.SetValue(TextBox.VisibilityProperty, Visibility.Hidden);
textBox.SetValue(TextBox.IsReadOnlyCaretVisibleProperty, true);
textBox.SetValue(TextBox.IsReadOnlyProperty, true);
if (TooltipPropertyName != null)
textBox.SetBinding(FrameworkElement.ToolTipProperty, new Binding(TooltipPropertyName));
var grid = new FrameworkElementFactory(typeof(Grid));
grid.AppendChild(textBlock);
grid.AppendChild(textBox);
template = new DataTemplate {
VisualTree = grid,
Triggers = {
new Trigger {
Property = UIElement.IsMouseOverProperty,
Value = true,
Setters = {
new Setter(UIElement.VisibilityProperty, Visibility.Visible, "textBox"),
new Setter(UIElement.VisibilityProperty, Visibility.Hidden, "textBlock"),
}
},
new Trigger {
Property = UIElement.IsKeyboardFocusWithinProperty,
Value = true,
Setters = {
new Setter(UIElement.VisibilityProperty, Visibility.Visible, "textBox"),
new Setter(UIElement.VisibilityProperty, Visibility.Hidden, "textBlock"),
}
}
}
};
return template;
}
}
}

36
ILSpy/Metadata/FlagsFilterControl.xaml

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
<Control x:Class="ICSharpCode.ILSpy.Metadata.FlagsFilterControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ICSharpCode.ILSpy.Metadata"
xmlns:dgx="urn:tom-englert.de/DataGridExtensions"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Control.Template>
<ControlTemplate>
<Grid>
<ToggleButton x:Name="ToggleButton">
<ToggleButton.Template>
<ControlTemplate>
<Border Background="#01010101">
<Control x:Name="FilterSymbol" Style="{DynamicResource {x:Static dgx:DataGridFilter.IconStyleKey}}" />
</Border>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Popup d:DataContext="{d:DesignInstance dgx:DataGridFilterColumnControl}"
x:Name="Popup" IsOpen="{Binding Path=IsChecked, ElementName=ToggleButton, Mode=TwoWay}"
AllowsTransparency="True" StaysOpen="False">
<ListBox x:Name="ListBox" SelectionMode="Extended" SelectionChanged="ListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox DockPanel.Dock="Left" Margin="3,2" Content="{Binding Name}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Popup>
</Grid>
</ControlTemplate>
</Control.Template>
</Control>

115
ILSpy/Metadata/FlagsFilterControl.xaml.cs

@ -0,0 +1,115 @@ @@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using DataGridExtensions;
namespace ICSharpCode.ILSpy.Metadata
{
/// <summary>
/// Interaction logic for FlagsFilterControl.xaml
/// </summary>
public partial class FlagsFilterControl
{
ListBox listBox;
public FlagsFilterControl()
{
InitializeComponent();
}
public FlagsContentFilter Filter {
get { return (FlagsContentFilter)GetValue(FilterProperty); }
set { SetValue(FilterProperty, value); }
}
public Type FlagsType { get; set; }
/// <summary>
/// Identifies the Filter dependency property
/// </summary>
public static readonly DependencyProperty FilterProperty =
DependencyProperty.Register("Filter", typeof(FlagsContentFilter), typeof(FlagsFilterControl),
new FrameworkPropertyMetadata(new FlagsContentFilter(-1), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (sender, e) => ((FlagsFilterControl)sender).Filter_Changed()));
/// <summary>When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate" />.</summary>
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
listBox = Template.FindName("ListBox", this) as ListBox;
listBox.ItemsSource = CreateFlags(FlagsType);
var filter = Filter;
if (filter == null || filter.Mask == -1) {
listBox?.SelectAll();
}
}
internal static IEnumerable<Flag> CreateFlags(Type flagsType, bool includeAll = true)
{
if (includeAll)
yield return new Flag("<All>", -1);
foreach (var item in flagsType.GetFields(BindingFlags.Static | BindingFlags.Public)) {
if (item.Name.EndsWith("Mask", StringComparison.Ordinal))
continue;
int value = (int)item.GetRawConstantValue();
yield return new Flag($"{item.Name} ({value:X4})", value);
}
}
private void Filter_Changed()
{
var filter = Filter;
if (filter == null || filter.Mask == -1) {
listBox?.SelectAll();
return;
}
if (listBox?.SelectedItems.Count != 0)
return;
foreach (var item in listBox.Items.Cast<Flag>()) {
if ((item.Value & filter.Mask) != 0 || item.Value == 0) {
listBox.SelectedItems.Add(item);
}
}
}
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.RemovedItems?.OfType<Flag>().Any(f => f.Value == -1) == true) {
Filter = new FlagsContentFilter(0);
listBox.UnselectAll();
return;
}
int mask = 0;
foreach (var item in listBox.SelectedItems.Cast<Flag>()) {
mask |= item.Value;
}
Filter = new FlagsContentFilter(mask);
}
}
public class FlagsContentFilter : IContentFilter
{
public int Mask { get; }
public FlagsContentFilter(int mask)
{
this.Mask = mask;
}
public bool IsMatch(object value)
{
return (Mask & (int)value) != 0;
}
}
}

24
ILSpy/Metadata/FlagsTooltip.xaml

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
<Control x:Class="ICSharpCode.ILSpy.Metadata.FlagsTooltip"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ICSharpCode.ILSpy.Metadata"
x:Name="root"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Control.Resources>
<local:FlagActiveConverter x:Key="flagActiveConv" />
</Control.Resources>
<Control.Template>
<ControlTemplate>
<ListBox ItemsSource="{Binding Flags, ElementName=root}">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox DockPanel.Dock="Left" Margin="3,2" Content="{Binding Name}" IsChecked="{Binding Value, Converter={StaticResource flagActiveConv}, Mode=OneWay}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ControlTemplate>
</Control.Template>
</Control>

66
ILSpy/Metadata/FlagsTooltip.xaml.cs

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ICSharpCode.ILSpy.Metadata
{
/// <summary>
/// Interaction logic for FlagsTooltip.xaml
/// </summary>
public partial class FlagsTooltip
{
public FlagsTooltip(int value, Type flagsType)
{
this.Flags = FlagsFilterControl.CreateFlags(flagsType, includeAll: false);
InitializeComponent();
((FlagActiveConverter)Resources["flagActiveConv"]).Value = value;
}
public IEnumerable<Flag> Flags { get; }
}
class FlagActiveConverter : DependencyObject, IValueConverter
{
public int Value {
get { return (int)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(int), typeof(FlagActiveConverter), new PropertyMetadata(0));
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Value == (int)value || ((int)value & Value) != 0;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public readonly struct Flag
{
public string Name { get; }
public int Value { get; }
public Flag(string name, int value)
{
this.Name = name;
this.Value = value;
}
}
}

125
ILSpy/Metadata/Helpers.cs

@ -16,7 +16,9 @@ @@ -16,7 +16,9 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata.Ecma335;
@ -24,29 +26,108 @@ using System.Text; @@ -24,29 +26,108 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using DataGridExtensions;
using ICSharpCode.ILSpy.Controls;
using ICSharpCode.ILSpy.ViewModels;
namespace ICSharpCode.ILSpy.Metadata
{
static class Helpers
{
public static ListView CreateListView(string name)
public static DataGrid PrepareDataGrid(TabPageModel tabPage)
{
MetadataTableViews dict = new MetadataTableViews();
var view = new ListView {
View = (GridView)dict[name],
ItemContainerStyle = (Style)dict["ItemContainerStyle"]
};
ContextMenuProvider.Add(view);
FilterableGridViewColumn.SetSortMode(view, ListViewSortMode.Automatic);
foreach (var column in ((GridView)view.View).Columns) {
FilterableGridViewColumn.SetParentView(column, view);
if (!(tabPage.Content is DataGrid view && view.Name == "MetadataView")) {
view = new DataGrid() {
Name = "MetadataView",
GridLinesVisibility = DataGridGridLinesVisibility.None,
CanUserAddRows = false,
CanUserDeleteRows = false,
CanUserReorderColumns = false,
RowHeaderWidth = 0,
SelectionMode = DataGridSelectionMode.Single,
SelectionUnit = DataGridSelectionUnit.FullRow,
CellStyle = new Style {
Setters = {
new Setter {
Property = Control.BorderThicknessProperty,
Value = new Thickness(0)
}
}
}
};
ContextMenuProvider.Add(view);
ScrollViewer.SetIsDeferredScrollingEnabled(view, true);
DataGridFilter.SetIsAutoFilterEnabled(view, true);
DataGridFilter.SetContentFilterFactory(view, new RegexContentFilterFactory());
}
view.AutoGeneratingColumn += View_AutoGeneratingColumn;
view.AutoGeneratedColumns += View_AutoGeneratedColumns;
return view;
}
private static void View_AutoGeneratedColumns(object sender, EventArgs e)
{
((DataGrid)sender).AutoGeneratedColumns -= View_AutoGeneratedColumns;
((DataGrid)sender).AutoGeneratingColumn -= View_AutoGeneratingColumn;
}
private static void View_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
var binding = new Binding(e.PropertyName) { Mode = BindingMode.OneWay };
e.Column = new DataGridCustomTextColumn() {
Header = e.PropertyName,
Binding = binding,
ToolTipBinding = new Binding(e.PropertyName + "Tooltip") { Mode = BindingMode.OneWay }
};
switch (e.PropertyName) {
case "RID":
e.Column.SetTemplate((ControlTemplate)MetadataTableViews.Instance["DefaultFilter"]);
break;
case "Token":
case "Offset":
case "RVA":
case "Signature":
binding.StringFormat = "X8";
e.Column.SetTemplate((ControlTemplate)MetadataTableViews.Instance["HexFilter"]);
break;
case "Name":
e.Column.SetTemplate((ControlTemplate)MetadataTableViews.Instance["DefaultFilter"]);
break;
case "Attributes":
case "ImplAttributes":
binding.Converter = new UnderlyingEnumValueConverter();
binding.StringFormat = "X4";
e.Column.SetTemplate((ControlTemplate)MetadataTableViews.Instance[e.PropertyType.Name + "Filter"]);
break;
default:
e.Cancel = e.PropertyName.Contains("Tooltip");
break;
}
}
class UnderlyingEnumValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var t = value.GetType();
if (t.IsEnum) {
var u = t.GetEnumUnderlyingType();
if (u == typeof(int))
return (int)value;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public static string AttributesToString(TypeAttributes attributes)
{
const TypeAttributes allMasks = TypeAttributes.ClassSemanticsMask | TypeAttributes.CustomFormatMask | TypeAttributes.LayoutMask | TypeAttributes.ReservedMask | TypeAttributes.StringFormatMask | TypeAttributes.VisibilityMask;
@ -65,17 +146,35 @@ namespace ICSharpCode.ILSpy.Metadata @@ -65,17 +146,35 @@ namespace ICSharpCode.ILSpy.Metadata
sb.AppendLine("Reserved attributes: " + (reserved == 0 ? "" : reserved.ToString()));
var additional = attributes & ~allMasks;
sb.Append("Additional attributes: ");
AdditionalAttributes(sb, additional);
AdditionalAttributes(sb, (int)additional);
if (sb.Length == 0)
return null;
return sb.ToString();
}
public static string AttributesToString(MethodAttributes attributes)
{
const MethodAttributes allMasks = MethodAttributes.MemberAccessMask | MethodAttributes.ReservedMask | MethodAttributes.VtableLayoutMask;
StringBuilder sb = new StringBuilder();
var visibility = attributes & MethodAttributes.MemberAccessMask;
sb.AppendLine("MemberAccess: " + (visibility == 0 ? "CompilerControlled" : typeof(MethodAttributes).GetEnumName(visibility)));
var layout = attributes & MethodAttributes.VtableLayoutMask;
sb.AppendLine("V-Table layout: " + (layout == 0 ? "ReuseSlot" : typeof(MethodAttributes).GetEnumName(layout)));
var reserved = attributes & MethodAttributes.ReservedMask;
sb.AppendLine("Reserved attributes: " + (reserved == 0 ? "" : reserved.ToString()));
var additional = attributes & ~allMasks;
sb.Append("Additional attributes: ");
AdditionalAttributes(sb, (int)additional);
if (sb.Length == 0)
return null;
return sb.ToString();
}
static void AdditionalAttributes(StringBuilder sb, TypeAttributes attributes)
static void AdditionalAttributes(StringBuilder sb, int attributes)
{
bool first = true;
for (int bit = 0; bit < 32; bit++) {
var value = (TypeAttributes)(1 << bit);
var value = 1 << bit;
if ((attributes & value) != 0) {
if (!first)
sb.Append(", ");

32
ILSpy/Metadata/HexFilterControl.xaml

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
<Control x:Class="ICSharpCode.ILSpy.Metadata.HexFilterControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ICSharpCode.ILSpy.Metadata"
xmlns:dgx="urn:tom-englert.de/DataGridExtensions"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Control.Template>
<ControlTemplate>
<Grid>
<Control Style="{DynamicResource {x:Static dgx:DataGridFilter.IconStyleKey}}"/>
<StackPanel x:Name="inputPanel" Orientation="Horizontal" Margin="4,0,0,0">
<TextBlock Text="0x"/>
<TextBox x:Name="textBox" TextChanged="TextBox_TextChanged" MinWidth="20" Style="{DynamicResource {x:Static dgx:DataGridFilter.ColumnHeaderSearchTextBoxStyleKey}}" />
</StackPanel>
</Grid>
<ControlTemplate.Triggers>
<Trigger SourceName="textBox" Property="Text" Value="">
<Setter TargetName="inputPanel" Property="Opacity" Value="0"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="inputPanel" Property="Opacity" Value="1"/>
</Trigger>
<Trigger SourceName="textBox" Property="IsFocused" Value="True">
<Setter TargetName="inputPanel" Property="Opacity" Value="1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Control.Template>
</Control>

84
ILSpy/Metadata/HexFilterControl.xaml.cs

@ -0,0 +1,84 @@ @@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DataGridExtensions;
namespace ICSharpCode.ILSpy.Metadata
{
/// <summary>
/// Interaction logic for HexFilterControl.xaml
/// </summary>
public partial class HexFilterControl
{
TextBox textBox;
public HexFilterControl()
{
InitializeComponent();
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
textBox = Template.FindName("textBox", this) as TextBox;
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
var text = ((TextBox)sender)?.Text;
Filter = new ContentFilter(text);
}
public IContentFilter Filter {
get { return (IContentFilter)GetValue(FilterProperty); }
set { SetValue(FilterProperty, value); }
}
/// <summary>
/// Identifies the Filter dependency property
/// </summary>
public static readonly DependencyProperty FilterProperty =
DependencyProperty.Register("Filter", typeof(IContentFilter), typeof(HexFilterControl),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (o, args) => ((HexFilterControl)o).Filter_Changed(args.NewValue)));
void Filter_Changed(object newValue)
{
var textBox = this.textBox;
if (textBox == null)
return;
textBox.Text = (newValue as ContentFilter)?.Value ?? string.Empty;
}
class ContentFilter : IContentFilter
{
readonly string filter;
public ContentFilter(string filter)
{
this.filter = filter;
}
public bool IsMatch(object value)
{
if (value == null)
return false;
return string.Format("{0:x8}", value).IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0;
}
public string Value => filter;
}
}
}

694
ILSpy/Metadata/MetadataTableViews.xaml

@ -1,660 +1,58 @@ @@ -1,660 +1,58 @@
<ResourceDictionary x:Class="ICSharpCode.ILSpy.Metadata.MetadataTableViews"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls"
xmlns:local="clr-namespace:ICSharpCode.ILSpy.Metadata">
<Style x:Key="ItemContainerStyle" TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
xmlns:local="clr-namespace:ICSharpCode.ILSpy.Metadata"
xmlns:reflection="clr-namespace:System.Reflection;assembly=mscorlib"
xmlns:dgx="urn:tom-englert.de/DataGridExtensions">
<Style x:Key="DataGridCustomTextColumnTextBoxStyle" TargetType="TextBox">
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="IsReadOnlyCaretVisible" Value="True" />
<Setter Property="Padding" Value="2" />
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="False" />
<Condition Property="IsFocused" Value="False" />
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</MultiTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=DataGridCell}}" Value="True" />
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=Self}}" Value="False" />
<Condition Binding="{Binding IsFocused, RelativeSource={RelativeSource Mode=Self}}" Value="False" />
</MultiDataTrigger.Conditions>
<Setter Property="Foreground" Value="White" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
<DataTemplate x:Key="RowIDDataTemplate">
<Grid>
<TextBlock Margin="3,1,0,0" x:Name="textBlock" Text="{Binding RID}" />
<TextBox x:Name="textBox" Text="{Binding RID, Mode=OneWay}" Visibility="Hidden" IsReadOnly="True" IsReadOnlyCaretVisible="True" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
<DataTemplate x:Key="OffsetDataTemplate">
<ControlTemplate x:Key="DefaultFilter">
<Grid>
<TextBlock Margin="3,1,0,0" x:Name="textBlock" Text="{Binding Offset, StringFormat=X8}" />
<TextBox x:Name="textBox" Text="{Binding Offset, Mode=OneWay, StringFormat=X8}" Visibility="Hidden" IsReadOnly="True" IsReadOnlyCaretVisible="True" />
<Control Style="{DynamicResource {x:Static dgx:DataGridFilter.IconStyleKey}}" />
<TextBox Style="{DynamicResource {x:Static dgx:DataGridFilter.ColumnHeaderSearchTextBoxStyleKey}}"
Text="{Binding Path=Filter, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
<local:ByteWidthConverter x:Key="byteWidthConverter" />
<local:HandleTemplate x:Key="DefinitionHandleDataTemplate" ValuePropertyName="Token" />
<local:StringHandleTemplate x:Key="NameStringHandleDataTemplate" ValuePropertyName="Name" HandlePropertyName="NameStringHandle" />
<local:StringHandleTemplate x:Key="NamespaceStringHandleDataTemplate" ValuePropertyName="Namespace" HandlePropertyName="NamespaceStringHandle" />
<local:HandleTemplate x:Key="SignatureBlobHandleDataTemplate" TooltipPropertyName="SignatureTooltip" ValuePropertyName="Signature" ValueStringFormat="X" />
<local:HandleTemplate x:Key="ValueBlobHandleDataTemplate" TooltipPropertyName="ValueTooltip" ValuePropertyName="Value" ValueStringFormat="X" />
<GridView x:Key="EntryView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="Member" SortBy="Member" FilterBy="Member">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Margin="3,1,0,0" x:Name="textBlock" Text="{Binding Member}" />
<TextBox x:Name="textBox" Text="{Binding Member, Mode=OneWay}" Visibility="Hidden" IsReadOnly="True" IsReadOnlyCaretVisible="True" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Size" SortBy="Size" FilterBy="Size">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Margin="3,1,0,0" x:Name="textBlock" Text="{Binding Size}" />
<TextBox x:Name="textBox" Text="{Binding Size, Mode=OneWay}" Visibility="Hidden" IsReadOnly="True" IsReadOnlyCaretVisible="True" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Value" SortBy="Value" FilterBy="Value">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Margin="3,1,0,0" x:Name="textBlock" Text="{Binding ., Converter={StaticResource byteWidthConverter}}" />
<TextBox x:Name="textBox" Text="{Binding ., Mode=OneWay, Converter={StaticResource byteWidthConverter}}" Visibility="Hidden" IsReadOnly="True" IsReadOnlyCaretVisible="True" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Meaning" SortBy="Meaning" FilterBy="Meaning">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Margin="3,1,0,0" x:Name="textBlock" Text="{Binding Meaning}" />
<TextBox x:Name="textBox" Text="{Binding Meaning, Mode=OneWay}" Visibility="Hidden" IsReadOnly="True" IsReadOnlyCaretVisible="True" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="ModulesView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Generation" SortBy="Generation" FilterBy="Generation">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Generation}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Mvid" SortBy="Mvid" FilterBy="Mvid">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Mvid, StringFormat=X}" ToolTip="{Binding MvidTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="GenerationId" SortBy="GenerationId" FilterBy="GenerationId">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding GenerationId, StringFormat=X}" ToolTip="{Binding GenerationIdTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="BaseGenerationId" SortBy="BaseGenerationId" FilterBy="BaseGenerationId">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding BaseGenerationId, StringFormat=X}" ToolTip="{Binding BaseGenerationIdTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="ModuleRefsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}" />
</GridView>
<GridView x:Key="TypeRefsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="ResolutionScope" SortBy="ResolutionScope" FilterBy="ResolutionScope">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="ResolutionScope" TooltipPropertyName="ResolutionScopeSignature" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}" />
<controls:FilterableGridViewColumn Header="Namespace" SortBy="Namespace" FilterBy="Namespace" CellTemplateSelector="{StaticResource NamespaceStringHandleDataTemplate}"/>
</GridView>
<GridView x:Key="TypeDefsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Namespace" SortBy="Namespace" FilterBy="Namespace" CellTemplateSelector="{StaticResource NamespaceStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="BaseType" SortBy="BaseType" FilterBy="BaseType">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="BaseType" TooltipPropertyName="BaseTypeSignature" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="FieldList" SortBy="FieldList" FilterBy="FieldList">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding FieldList, StringFormat=X}" ToolTip="{Binding FieldListTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="MethodList" SortBy="MethodList" FilterBy="MethodList">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding MethodList, StringFormat=X}" ToolTip="{Binding MethodListTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="TypeSpecsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Signature" SortBy="Signature" FilterBy="Signature" CellTemplateSelector="{StaticResource SignatureBlobHandleDataTemplate}"/>
</GridView>
<GridView x:Key="FieldDefsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Signature" SortBy="Signature" FilterBy="Signature" CellTemplateSelector="{StaticResource SignatureBlobHandleDataTemplate}"/>
</GridView>
</ControlTemplate>
<ControlTemplate x:Key="HexFilter">
<local:HexFilterControl Filter="{Binding Path=Filter, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=dgx:DataGridFilterColumnControl}}" />
</ControlTemplate>
<GridView x:Key="MethodDefsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Signature" SortBy="Signature" FilterBy="Signature" CellTemplateSelector="{StaticResource SignatureBlobHandleDataTemplate}"/>
</GridView>
<ControlTemplate x:Key="MethodAttributesFilter">
<local:FlagsFilterControl FlagsType="{x:Type reflection:MethodAttributes}" Filter="{Binding Path=Filter, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=dgx:DataGridFilterColumnControl}}" />
</ControlTemplate>
<GridView x:Key="EventDefsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Type" SortBy="Type" FilterBy="Type">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="Type" TooltipPropertyName="TypeTooltip" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<ControlTemplate x:Key="MethodImplAttributesFilter">
<local:FlagsFilterControl FlagsType="{x:Type reflection:MethodImplAttributes}" Filter="{Binding Path=Filter, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=dgx:DataGridFilterColumnControl}}" />
</ControlTemplate>
<GridView x:Key="PropertyDefsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Signature" SortBy="Signature" FilterBy="Signature" CellTemplateSelector="{StaticResource SignatureBlobHandleDataTemplate}"/>
</GridView>
<GridView x:Key="AssemblyView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="HashAlgorithm" SortBy="HashAlgorithm" FilterBy="HashAlgorithm">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:EnumTemplate ValuePropertyName="HashAlgorithm" TooltipPropertyName="HashAlgorithmTooltip"/>
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Flags" SortBy="Flags" FilterBy="Flags">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:EnumTemplate ValuePropertyName="Flags" TooltipPropertyName="FlagsTooltip"/>
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Version" SortBy="Version" FilterBy="Version">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Margin="3,1,0,0" x:Name="textBlock" Text="{Binding Version}" />
<TextBox x:Name="textBox" Text="{Binding Version, Mode=OneWay}" Visibility="Hidden" IsReadOnly="True" IsReadOnlyCaretVisible="True" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Culture" SortBy="Culture" FilterBy="Culture">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:StringHandleTemplate HandlePropertyName="CultureStringHandle" ValuePropertyName="Culture" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="AssemblyRefView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Flags" SortBy="Flags" FilterBy="Flags">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:EnumTemplate ValuePropertyName="Flags" TooltipPropertyName="FlagsTooltip"/>
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="PublicKeyOrToken" SortBy="PublicKeyOrToken" FilterBy="PublicKeyOrToken">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="PublicKeyOrToken" TooltipPropertyName="PublicKeyOrTokenTooltip" ValueStringFormat="X" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Version" SortBy="Version" FilterBy="Version">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Margin="3,1,0,0" x:Name="textBlock" Text="{Binding Version}" />
<TextBox x:Name="textBox" Text="{Binding Version, Mode=OneWay}" Visibility="Hidden" IsReadOnly="True" IsReadOnlyCaretVisible="True" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="textBox" Property="Visibility" Value="Visible" />
<Setter TargetName="textBlock" Property="Visibility" Value="Hidden" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Culture" SortBy="Culture" FilterBy="Culture">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:StringHandleTemplate HandlePropertyName="CultureStringHandle" ValuePropertyName="Culture" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="ExportedTypesView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="TypeDefId" SortBy="TypeDefId" FilterBy="TypeDefId">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding TypeDefId, StringFormat=X}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="TypeName" SortBy="TypeName" FilterBy="TypeName">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:StringHandleTemplate HandlePropertyName="TypeNamespaceStringHandle" ValuePropertyName="TypeName"/>
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="TypeNamespace" SortBy="TypeNamespace" FilterBy="TypeNamespace">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:StringHandleTemplate HandlePropertyName="TypeNamespaceStringHandle" ValuePropertyName="TypeNamespace"/>
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Implementation" SortBy="Implementation" FilterBy="Implementation">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Implementation, StringFormat=X8}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="MethodSpecsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Method" SortBy="MethodHandle" FilterBy="MethodHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="MethodHandle" TooltipPropertyName="Method" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Signature" SortBy="Signature" FilterBy="Signature" CellTemplateSelector="{StaticResource SignatureBlobHandleDataTemplate}"/>
</GridView>
<GridView x:Key="MemberRefsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Parent" SortBy="ParentHandle" FilterBy="ParentHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="ParentHandle" TooltipPropertyName="ParentTooltip" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Signature" SortBy="Signature" FilterBy="Signature" CellTemplateSelector="{StaticResource SignatureBlobHandleDataTemplate}"/>
</GridView>
<GridView x:Key="CustomAttributesView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Parent" SortBy="ParentHandle" FilterBy="ParentHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="ParentHandle" TooltipPropertyName="ParentTooltip" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Constructor" SortBy="ConstructorHandle" FilterBy="ConstructorHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="ConstructorHandle" TooltipPropertyName="ConstructorTooltip" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Value" SortBy="ValueHandle" FilterBy="ValueHandle">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="ValueHandle" TooltipPropertyName="ValueTooltip" ValueStringFormat="X" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="DeclSecurityAttrsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Parent" SortBy="ParentHandle" FilterBy="ParentHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="ParentHandle" TooltipPropertyName="ParentTooltip" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Action" SortBy="Action" FilterBy="Action" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Action, StringFormat=X8}" ToolTip="{Binding ActionTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="PermissionSet" SortBy="PermissionSetHandle" FilterBy="PermissionSetHandle">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="PermissionSetHandle" TooltipPropertyName="PermissionSetTooltip" ValueStringFormat="X" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="MethodSemanticsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Semantics" SortBy="Semantics" FilterBy="Semantics" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Semantics, StringFormat=X8}" ToolTip="{Binding SemanticsTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Method" SortBy="MethodHandle" FilterBy="MethodHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="MethodHandle" TooltipPropertyName="Method" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Association" SortBy="AssociationHandle" FilterBy="AssociationHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="AssociationHandle" TooltipPropertyName="Association" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="ManifestResourcesView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Implementation" SortBy="ImplementationHandle" FilterBy="ImplementationHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="ImplementationHandle" TooltipPropertyName="ImplementationTooltip" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="FilesView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="HashValue" SortBy="HashValue" FilterBy="HashValue">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="HashValue" TooltipPropertyName="HashValueTooltip" ValueStringFormat="X" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<GridView x:Key="StandAloneSigsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Signature" SortBy="Signature" FilterBy="Signature" CellTemplateSelector="{StaticResource SignatureBlobHandleDataTemplate}"/>
</GridView>
<GridView x:Key="ConstantsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Type" SortBy="Type" FilterBy="Type">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Type, StringFormat=X8}" ToolTip="{Binding TypeTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Parent" SortBy="ParentHandle" FilterBy="ParentHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="ParentHandle" TooltipPropertyName="ParentTooltip" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Value" SortBy="Value" FilterBy="Value" CellTemplateSelector="{StaticResource ValueBlobHandleDataTemplate}"/>
</GridView>
<GridView x:Key="ParamsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Sequence" SortBy="Sequence" FilterBy="Sequence">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Sequence}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
</GridView>
<GridView x:Key="GenericParamsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Number" SortBy="Number" FilterBy="Number">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Number}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Attributes" SortBy="Attributes" FilterBy="Attributes">
<controls:FilterableGridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attributes, StringFormat=X8}" ToolTip="{Binding AttributesTooltip}" />
</DataTemplate>
</controls:FilterableGridViewColumn.CellTemplate>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Owner" SortBy="OwnerHandle" FilterBy="OwnerHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="OwnerHandle" TooltipPropertyName="Owner" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Name" SortBy="Name" FilterBy="Name" CellTemplateSelector="{StaticResource NameStringHandleDataTemplate}"/>
</GridView>
<GridView x:Key="GenericParamConstraintsView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Owner" SortBy="OwnerHandle" FilterBy="OwnerHandle" FilterFormatString="X8">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="OwnerHandle" TooltipPropertyName="Owner" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="Type" SortBy="Type" FilterBy="Type">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="Type" TooltipPropertyName="TypeTooltip" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<Style x:Key="ItemContainerStyle" TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
<GridView x:Key="MethodImplView" AllowsColumnReorder="False">
<controls:FilterableGridViewColumn Header="RID" SortBy="RID" FilterBy="RID" CellTemplate="{StaticResource RowIDDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Token" SortBy="Token" FilterBy="Token" FilterFormatString="X8" CellTemplateSelector="{StaticResource DefinitionHandleDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Offset" SortBy="Offset" FilterBy="Offset" FilterFormatString="X8" CellTemplate="{StaticResource OffsetDataTemplate}"/>
<controls:FilterableGridViewColumn Header="Type" SortBy="TypeHandle" FilterBy="TypeHandle">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="TypeHandle" TooltipPropertyName="Type" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="MethodBody" SortBy="MethodBodyHandle" FilterBy="MethodBodyHandle">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="MethodBodyHandle" TooltipPropertyName="MethodBody" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
<controls:FilterableGridViewColumn Header="MethodDeclaration" SortBy="MethodDeclarationHandle" FilterBy="MethodDeclarationHandle">
<controls:FilterableGridViewColumn.CellTemplateSelector>
<local:HandleTemplate ValuePropertyName="MethodDeclarationHandle" TooltipPropertyName="MethodDeclaration" />
</controls:FilterableGridViewColumn.CellTemplateSelector>
</controls:FilterableGridViewColumn>
</GridView>
<local:ByteWidthConverter x:Key="byteWidthConverter" />
</ResourceDictionary>

93
ILSpy/Metadata/StringHandleTemplate.cs

@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace ICSharpCode.ILSpy.Metadata
{
public class StringHandleTemplate : DataTemplateSelector
{
public string ValuePropertyName { get; set; }
public string HandlePropertyName { get; set; }
private DataTemplate template;
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
if (template != null)
return template;
var textBlock = new FrameworkElementFactory(typeof(TextBlock), "textBlock");
textBlock.SetValue(FrameworkElement.MarginProperty, new Thickness(3, 1, 0, 0));
textBlock.SetBinding(TextBlock.TextProperty, new Binding(ValuePropertyName) { StringFormat = "\"{0}\"" });
var textBox = new FrameworkElementFactory(typeof(TextBox), "textBox");
textBox.SetBinding(TextBox.TextProperty, new Binding(ValuePropertyName) { StringFormat = "\"{0}\"", Mode = BindingMode.OneWay });
textBox.SetValue(TextBox.VisibilityProperty, Visibility.Hidden);
textBox.SetValue(TextBox.IsReadOnlyCaretVisibleProperty, true);
textBox.SetValue(TextBox.IsReadOnlyProperty, true);
textBox.SetBinding(FrameworkElement.ToolTipProperty, new MultiBinding {
Converter = new StringHandleConverter(),
Bindings = {
new Binding(HandlePropertyName),
new Binding(ValuePropertyName)
}
});
var grid = new FrameworkElementFactory(typeof(Grid));
grid.AppendChild(textBlock);
grid.AppendChild(textBox);
template = new DataTemplate {
VisualTree = grid,
Triggers = {
new Trigger {
Property = UIElement.IsMouseOverProperty,
Value = true,
Setters = {
new Setter(UIElement.VisibilityProperty, Visibility.Visible, "textBox"),
new Setter(UIElement.VisibilityProperty, Visibility.Hidden, "textBlock"),
}
},
new Trigger {
Property = UIElement.IsKeyboardFocusWithinProperty,
Value = true,
Setters = {
new Setter(UIElement.VisibilityProperty, Visibility.Visible, "textBox"),
new Setter(UIElement.VisibilityProperty, Visibility.Hidden, "textBlock"),
}
}
}
};
return template;
}
private class StringHandleConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return string.Format("{0:X} \"{1}\"", values[0], values[1]);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
}

39
ILSpy/themes/generic.xaml

@ -26,43 +26,4 @@ @@ -26,43 +26,4 @@
Data = "M 5,5 L 10,10 L 15,5 L 5,5"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="{ComponentResourceKey {x:Type controls:FilterableGridViewColumn}, ColumnHeaderTemplate}">
<StackPanel Orientation="Horizontal">
<TextBlock HorizontalAlignment="Center" Text="{Binding}"/>
<Path x:Name="upArrow"
Visibility="{Binding Path=Column.SortDirection, ConverterParameter={x:Static controls:ColumnSortDirection.Ascending}, RelativeSource={RelativeSource AncestorType={x:Type GridViewColumnHeader}}, Converter={StaticResource ColumnSortDirectionToVisibilityConverter}}"
StrokeThickness = "1"
Fill = "Gray"
Data = "M 5,10 L 15,10 L 10,5 L 5,10"/>
<Path x:Name="downArrow"
Visibility="{Binding Path=Column.SortDirection, ConverterParameter={x:Static controls:ColumnSortDirection.Descending}, RelativeSource={RelativeSource AncestorType={x:Type GridViewColumnHeader}}, Converter={StaticResource ColumnSortDirectionToVisibilityConverter}}"
StrokeThickness = "1"
Fill = "Gray"
Data = "M 5,5 L 10,10 L 15,5 L 5,5"/>
<CheckBox x:Name="isFilterOpen">
<CheckBox.Template>
<ControlTemplate TargetType="CheckBox">
<Path x:Name="filterSymbol"
StrokeThickness="1"
Fill="Gray"
Data="M 0,0L 20,0L 14,6L 14,12L 6,12L 6,6L 0,0"/>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="filterSymbol" Property="Fill" Value="Gray"/>
<Setter TargetName="filterSymbol" Property="Stroke" Value="Transparent"/>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="filterSymbol" Property="Fill" Value="Transparent"/>
<Setter TargetName="filterSymbol" Property="Stroke" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</CheckBox.Template>
</CheckBox>
<Popup StaysOpen="True" Placement="Top" HorizontalOffset="16" IsOpen="{Binding IsChecked, ElementName=isFilterOpen}">
<TextBox x:Name="filter" Height="24" Width="100" Text="{Binding Path=Column.FilterExpression, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type GridViewColumnHeader}}}" />
</Popup>
</StackPanel>
</DataTemplate>
</ResourceDictionary>
Loading…
Cancel
Save