InvalidOperationException when using HorizontalRange

Apr 28, 2010 at 11:21 AM

Hi,

I get an InvalidOperationException with the detail:

Layout measurement override of element 'System.Windows.Shapes.Path' should not return PositiveInfinity as its DesiredSize, even if Infinity is passed in as available size.

when using a HorizontalRange within a ChartPlotter if both of the following conditions are present:

1. The HorizontalRange Value1 attribute is less than the current Y Axis minimum value

2. The ChartPlotter is hosted by a Grid row with height set to Auto

I've modified the sample LineSample as show below to reproduce the problem.  

 

 

    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
            <c:ChartPlotter Name="plotter"  Margin="10" Grid.Row="0">
			<c:RectangleHighlight Bounds="0.1, 0.6, 0.15, 0.2" StrokeThickness="2" Fill="MidnightBlue"
									 ToolTip="Sample region"/>
			<c:HorizontalLine Value="0.5" StrokeThickness="2" ToolTip="Hamster was here"/>
			<c:HorizontalLine Value="0.25"/>
			<c:VerticalLine Value="0.4"/>
			<c:VerticalLine Value="0.7"/>
			<c:Segment StartPoint="0.3, 0.45" EndPoint="0.5, 0.65" Stroke="Green" StrokeThickness="2"
								 StrokeDashArray="2"/>
			<c:HorizontalRange Value1="-0.4" Value2="0.5" Fill="Green"/>
			<c:VerticalRange Value1="0.1" Value2="0.12" Fill="Fuchsia"/>

			<c:ViewportUIContainer Position="0.3,0.7">
				<Button>Hello!</Button>
			</c:ViewportUIContainer>
		</c:ChartPlotter>
    </Grid>

 

I've checked the four overrides of MeasureOverride and added

            if (Double.IsPositiveInfinity(availableSize.Width))
                availableSize.Width = 0;
            if (Double.IsPositiveInfinity(availableSize.Height)) 
                availableSize.Height = 0;

to the end of the MeasureOverride in ViewportRectPanel but this didn't help.

Any ideas?

Grant.

Apr 28, 2010 at 11:26 AM
Sorry this is not an answer, but I also experience the same issue and tried to do exactly as you did - the MeasureOverride IsInfinity check - but like you, had no success.
 
Anyone able to help us out?

On 28 April 2010 13:22, grantnz <notifications@codeplex.com> wrote:

From: grantnz

Hi,

I get an InvalidOperationException with the detail:

Layout measurement override of element 'System.Windows.Shapes.Path' should not return PositiveInfinity as its DesiredSize, even if Infinity is passed in as available size.

when using a HorizontalRange within a ChartPlotter if both of the following conditions are present:

1. The HorizontalRange Value1 attribute is less than the current Y Axis minimum value

2. The ChartPlotter is hosted by a Grid row with height set to Auto

I've modified the sample LineSample as show below to reproduce the problem.  

 

 

    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
            <c:ChartPlotter Name="plotter"  Margin="10" Grid.Row="0">
			<c:RectangleHighlight Bounds="0.1, 0.6, 0.15, 0.2" StrokeThickness="2" Fill="MidnightBlue"
									 ToolTip="Sample region"/>
			<c:HorizontalLine Value="0.5" StrokeThickness="2" ToolTip="Hamster was here"/>
			<c:HorizontalLine Value="0.25"/>
			<c:VerticalLine Value="0.4"/>
			<c:VerticalLine Value="0.7"/>
			<c:Segment StartPoint="0.3, 0.45" EndPoint="0.5, 0.65" Stroke="Green" StrokeThickness="2"
								 StrokeDashArray="2"/>
			<c:HorizontalRange Value1="-0.4" Value2="0.5" Fill="Green"/>
			<c:VerticalRange Value1="0.1" Value2="0.12" Fill="Fuchsia"/>

			<c:ViewportUIContainer Position="0.3,0.7">
				<Button>Hello!</Button>
			</c:ViewportUIContainer>
		</c:ChartPlotter>
    </Grid>

 

I've checked the four overrides of MeasureOverride and added

            if (Double.IsPositiveInfinity(availableSize.Width))
                availableSize.Width = 0;
            if (Double.IsPositiveInfinity(availableSize.Height)) 
                availableSize.Height = 0;

to the end of the MeasureOverride in ViewportRectPanel but this didn't help.

Any ideas?

Grant.

Read the full discussion online.

To add a post to this discussion, reply to this email (dynamicdatadisplay@discussions.codeplex.com)

To start a new discussion for this project, email dynamicdatadisplay@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
Dr Peter Freestone (PhD)

work: Fondazione Santa Lucia
Experimental Neurology Lab
Via del Fosso di Fiorano 64
Roma, Italy 00143

home: via della fotografia, 94
Rome, Italy 00142

work: +39 (06) 50170 3156
fax: +39 (06) 50170 3307
mobile: +39 328 185 2636


Apr 28, 2010 at 11:37 AM

There's also some odd behavior when you pan a chart vertically and cause a HorizontalRange to move outside the viewport.  Again, this problem occurs when the ChartPlotter is in a Grid.Row with height set to "Auto"