Browse Source

#1803: Fix ArgumentException when dragging Resources view out of the main window.

pull/1820/head
Siegfried Pammer 6 years ago
parent
commit
3c166034cc
  1. 8
      ILSpy/Controls/ResourceObjectTable.xaml.cs
  2. 8
      ILSpy/Controls/ResourceStringTable.xaml.cs

8
ILSpy/Controls/ResourceObjectTable.xaml.cs

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
// 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;
@ -34,15 +35,16 @@ namespace ICSharpCode.ILSpy.Controls @@ -34,15 +35,16 @@ namespace ICSharpCode.ILSpy.Controls
InitializeComponent();
// set size to fit decompiler window
container.SizeChanged += OnParentSizeChanged;
Width = container.ActualWidth - 45;
if (!double.IsNaN(container.ActualWidth))
Width = Math.Max(container.ActualWidth - 45, 0);
MaxHeight = container.ActualHeight;
resourceListView.ItemsSource = resources;
}
private void OnParentSizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.WidthChanged)
Width = e.NewSize.Width - 45;
if (e.WidthChanged && !double.IsNaN(e.NewSize.Width))
Width = Math.Max(e.NewSize.Width - 45, 0);
if (e.HeightChanged)
MaxHeight = e.NewSize.Height;
}

8
ILSpy/Controls/ResourceStringTable.xaml.cs

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
// 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;
@ -34,15 +35,16 @@ namespace ICSharpCode.ILSpy.Controls @@ -34,15 +35,16 @@ namespace ICSharpCode.ILSpy.Controls
InitializeComponent();
// set size to fit decompiler window
container.SizeChanged += OnParentSizeChanged;
Width = container.ActualWidth - 45;
if (!double.IsNaN(container.ActualWidth))
Width = Math.Max(container.ActualWidth - 45, 0);
MaxHeight = container.ActualHeight;
resourceListView.ItemsSource = strings;
}
private void OnParentSizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.WidthChanged)
Width = e.NewSize.Width - 45;
if (e.WidthChanged && !double.IsNaN(e.NewSize.Width))
Width = Math.Max(e.NewSize.Width - 45, 0);
if (e.HeightChanged)
MaxHeight = e.NewSize.Height;
}

Loading…
Cancel
Save