Browse Source

Adapt size of ResourceStringTable/ResourceObjectTable on changed size of MainWindow.mainPane.

pull/516/head
Ronny Klier 11 years ago
parent
commit
6a3a1b1a7c
  1. 26
      ILSpy/Controls/ResourceObjectTable.xaml.cs
  2. 22
      ILSpy/Controls/ResourceStringTable.xaml.cs
  3. 8
      ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs

26
ILSpy/Controls/ResourceObjectTable.xaml.cs

@ -30,17 +30,25 @@ namespace ICSharpCode.ILSpy.Controls
/// </summary> /// </summary>
public partial class ResourceObjectTable : UserControl public partial class ResourceObjectTable : UserControl
{ {
public ResourceObjectTable(IEnumerable resources,Size maxSize) public ResourceObjectTable(IEnumerable resources, ContentPresenter contentPresenter)
{ {
InitializeComponent(); InitializeComponent();
// set size to fit decompiler window // set size to fit decompiler window
// TODO: there should be a more transparent way to do this contentPresenter.SizeChanged += OnParentSizeChanged;
Width = maxSize.Width; Width = contentPresenter.ActualWidth - 45;
MaxHeight = maxSize.Height; MaxHeight = contentPresenter.ActualHeight;
resourceListView.ItemsSource = resources; resourceListView.ItemsSource = resources;
} }
void ExecuteCopy(object sender, ExecutedRoutedEventArgs args) private void OnParentSizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.WidthChanged)
Width = e.NewSize.Width - 45;
if (e.HeightChanged)
MaxHeight = e.NewSize.Height;
}
void ExecuteCopy(object sender, ExecutedRoutedEventArgs args)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
foreach (var item in resourceListView.SelectedItems) foreach (var item in resourceListView.SelectedItems)

22
ILSpy/Controls/ResourceStringTable.xaml.cs

@ -30,15 +30,23 @@ namespace ICSharpCode.ILSpy.Controls
/// </summary> /// </summary>
public partial class ResourceStringTable : UserControl public partial class ResourceStringTable : UserControl
{ {
public ResourceStringTable(IEnumerable strings,Size maxSize) public ResourceStringTable(IEnumerable strings, ContentPresenter contentPresenter)
{ {
InitializeComponent(); InitializeComponent();
// set size to fit decompiler window // set size to fit decompiler window
// TODO: there should be a more transparent way to do this contentPresenter.SizeChanged += OnParentSizeChanged;
Width = maxSize.Width; Width = contentPresenter.ActualWidth - 45;
MaxHeight = maxSize.Height; MaxHeight = contentPresenter.ActualHeight;
resourceListView.ItemsSource = strings; resourceListView.ItemsSource = strings;
} }
private void OnParentSizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.WidthChanged)
Width = e.NewSize.Width - 45;
if (e.HeightChanged)
MaxHeight = e.NewSize.Height;
}
void ExecuteCopy(object sender, ExecutedRoutedEventArgs args) void ExecuteCopy(object sender, ExecutedRoutedEventArgs args)
{ {

8
ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs

@ -121,9 +121,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
if (null != smartOutput) { if (null != smartOutput) {
smartOutput.AddUIElement( smartOutput.AddUIElement(
delegate { delegate {
return new ResourceStringTable(stringTableEntries, return new ResourceStringTable(stringTableEntries, MainWindow.Instance.mainPane);
new System.Windows.Size(MainWindow.Instance.mainPane.ActualWidth - 45,
MainWindow.Instance.mainPane.ActualHeight));
} }
); );
} }
@ -135,9 +133,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
if (null != smartOutput) { if (null != smartOutput) {
smartOutput.AddUIElement( smartOutput.AddUIElement(
delegate { delegate {
return new ResourceObjectTable(otherEntries, return new ResourceObjectTable(otherEntries, MainWindow.Instance.mainPane);
new System.Windows.Size(MainWindow.Instance.mainPane.ActualWidth - 45,
MainWindow.Instance.mainPane.ActualHeight));
} }
); );
} }

Loading…
Cancel
Save