mirror of https://github.com/icsharpcode/ILSpy.git
6 changed files with 199 additions and 25 deletions
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<UserControl x:Class="ICSharpCode.ILSpy.Controls.ResourceObjectTable" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<UserControl.CommandBindings> |
||||
<CommandBinding Command="ApplicationCommands.Copy" |
||||
Executed="ExecuteCopy" |
||||
CanExecute="CanExecuteCopy" /> |
||||
</UserControl.CommandBindings> |
||||
<Grid Margin="5,0,0,0"> |
||||
<Grid.Resources> |
||||
<AlternationConverter x:Key="BackgroundConverter"> |
||||
<SolidColorBrush Color="White"></SolidColorBrush> |
||||
<SolidColorBrush Color="Beige"></SolidColorBrush> |
||||
</AlternationConverter> |
||||
<Style x:Key="alternatingWithBinding" |
||||
TargetType="{x:Type ListBoxItem}"> |
||||
<Setter Property="Background" |
||||
Value="{Binding RelativeSource={RelativeSource Self}, |
||||
Path=(ItemsControl.AlternationIndex), |
||||
Converter={StaticResource BackgroundConverter}}" /> |
||||
</Style> |
||||
</Grid.Resources> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition /> |
||||
<RowDefinition /> |
||||
</Grid.RowDefinitions> |
||||
<Label Content="Other Resources" |
||||
FontFamily="Segoe UI" |
||||
FontWeight="Bold" |
||||
FontSize="14" /> |
||||
<ListView Name="resourceListView" |
||||
FontFamily="Segoe UI" |
||||
FontSize="12" |
||||
Foreground="Black" |
||||
Grid.Row="1" |
||||
AlternationCount="2" |
||||
ItemContainerStyle="{StaticResource alternatingWithBinding}"> |
||||
<ListView.View> |
||||
<GridView AllowsColumnReorder="False"> |
||||
<GridView.Columns> |
||||
<GridViewColumn DisplayMemberBinding="{Binding Key}"> |
||||
<GridViewColumnHeader Content="Name" |
||||
HorizontalContentAlignment="Left" |
||||
FontWeight="Bold" /> |
||||
</GridViewColumn> |
||||
<GridViewColumn DisplayMemberBinding="{Binding Value}"> |
||||
<GridViewColumnHeader Content="Value (as string)" |
||||
HorizontalContentAlignment="Left" |
||||
FontWeight="Bold" /> |
||||
</GridViewColumn> |
||||
<GridViewColumn DisplayMemberBinding="{Binding Type}"> |
||||
<GridViewColumnHeader Content="Type" |
||||
HorizontalContentAlignment="Left" |
||||
FontWeight="Bold" /> |
||||
</GridViewColumn> |
||||
</GridView.Columns> |
||||
</GridView> |
||||
</ListView.View> |
||||
</ListView> |
||||
</Grid> |
||||
</UserControl> |
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
// 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.Collections; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Input; |
||||
|
||||
namespace ICSharpCode.ILSpy.Controls |
||||
{ |
||||
/// <summary>
|
||||
/// Interaction logic for ResourceObjectTable.xaml
|
||||
/// </summary>
|
||||
public partial class ResourceObjectTable : UserControl |
||||
{ |
||||
public ResourceObjectTable(IEnumerable resources,Size maxSize) |
||||
{ |
||||
InitializeComponent(); |
||||
// set size to fit decompiler window
|
||||
// TODO: there should be a more transparent way to do this
|
||||
Width = maxSize.Width; |
||||
MaxHeight = maxSize.Height; |
||||
resourceListView.ItemsSource = resources; |
||||
} |
||||
|
||||
void ExecuteCopy(object sender, ExecutedRoutedEventArgs args) |
||||
{ |
||||
StringBuilder sb = new StringBuilder(); |
||||
foreach (var item in resourceListView.SelectedItems) |
||||
{ |
||||
sb.AppendLine(item.ToString()); |
||||
} |
||||
Clipboard.SetText(sb.ToString()); |
||||
} |
||||
|
||||
void CanExecuteCopy(object sender, CanExecuteRoutedEventArgs args) |
||||
{ |
||||
args.CanExecute = true; |
||||
} |
||||
} |
||||
} |
@ -1,26 +1,58 @@
@@ -1,26 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<UserControl |
||||
x:Class="ICSharpCode.ILSpy.Controls.ResourceStringTable" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<UserControl x:Class="ICSharpCode.ILSpy.Controls.ResourceStringTable" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
> |
||||
<UserControl.CommandBindings> |
||||
<CommandBinding Command="ApplicationCommands.Copy" |
||||
Executed="ExecuteCopy" |
||||
CanExecute="CanExecuteCopy" /> |
||||
</UserControl.CommandBindings> |
||||
<ListView |
||||
Name="resourceListView" |
||||
SelectionMode="Extended"> |
||||
<Grid Margin="5,0,0,0"> |
||||
<Grid.Resources> |
||||
<AlternationConverter x:Key="BackgroundConverter"> |
||||
<SolidColorBrush Color="White"></SolidColorBrush> |
||||
<SolidColorBrush Color="Beige"></SolidColorBrush> |
||||
</AlternationConverter> |
||||
<Style x:Key="alternatingWithBinding" |
||||
TargetType="{x:Type ListBoxItem}"> |
||||
<Setter Property="Background" |
||||
Value="{Binding RelativeSource={RelativeSource Self}, |
||||
Path=(ItemsControl.AlternationIndex), |
||||
Converter={StaticResource BackgroundConverter}}" /> |
||||
</Style> |
||||
</Grid.Resources> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition /> |
||||
<RowDefinition /> |
||||
</Grid.RowDefinitions> |
||||
<Label Content="String Table" |
||||
FontFamily="Segoe UI" |
||||
FontWeight="Bold" |
||||
FontSize="14" /> |
||||
<ListView Name="resourceListView" |
||||
FontFamily="Segoe UI" |
||||
FontSize="12" |
||||
Foreground="Black" |
||||
Grid.Row="1" |
||||
AlternationCount="2" |
||||
ItemContainerStyle="{StaticResource alternatingWithBinding}"> |
||||
<ListView.View> |
||||
<GridView |
||||
AllowsColumnReorder="False"> |
||||
<GridView AllowsColumnReorder="False"> |
||||
<GridView.Columns> |
||||
<GridViewColumn |
||||
Header="Resource id" |
||||
DisplayMemberBinding="{Binding Key}" /> |
||||
<GridViewColumn |
||||
Header="Resource value" |
||||
DisplayMemberBinding="{Binding Value}" /> |
||||
<GridViewColumn DisplayMemberBinding="{Binding Key}"> |
||||
<GridViewColumnHeader Content="Name" |
||||
HorizontalContentAlignment="Left" |
||||
FontWeight="Bold" /> |
||||
</GridViewColumn> |
||||
<GridViewColumn DisplayMemberBinding="{Binding Value}"> |
||||
<GridViewColumnHeader Content="Value" |
||||
HorizontalContentAlignment="Left" |
||||
FontWeight="Bold" /> |
||||
</GridViewColumn> |
||||
</GridView.Columns> |
||||
</GridView> |
||||
</ListView.View> |
||||
</ListView> |
||||
</Grid> |
||||
</UserControl> |
Loading…
Reference in new issue