Profile Picture

Using an Expander with a GridSplitter and NChartControl WPF

Posted By Fabio Olcese 8 Years Ago

Using an Expander with a GridSplitter and NChartControl WPF

Author
Message
Fabio Olcese
Problem Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 11, Visits: 40
The expander won't work properly. When I try to collapse the expander it will just leave a blank space and as soon as I move the GridSplitter it will properly collapse. When I try to expand it it won't do anything making it necessary to move the GridSplitter to the left so that the NChartControl appear.

I understand the the Expander and GridSplitter don't work well together so I am using the ExpanderGrid taken out from this page: http://www.cenito.se/2014/11/gridsplitter-expander-dont-work-together/ which made it work well with other Charting Components. 

It would seem that normally that the OnChildDesiredSizeChanged of the ExpanderGrid won't trigger when clicking the expander button as it would normally do.

The xaml code its something like this:

<v:ExpanderGrid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    
    <v:ExpanderGrid.ColumnDefinitions>
      <ColumnDefinition Width="2*"/>
      <ColumnDefinition Width="5"/>
      <ColumnDefinition Width="2*"/>
    </fv:ExpanderGrid.ColumnDefinitions>
    
    <DockPanel Grid.Column="0">
      <UserControl/>
      <UserControl/>
    </DockPanel>
    
    <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch"/>

    <Expander Grid.Column="2" ExpandDirection="Left" IsExpanded="{Binding Property}">
      <UserControl with NChartControl/>
    </Expander>

   </v:ExpanderGrid>

Thanks in advance.

Tags
WPF
Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
Hi Fabio,

Can you send us a project replicating this problem? Also what is the version of the control you're testing with?


Best Regards,
Nevron Support Team



Fabio Olcese
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 11, Visits: 40
Thanks for the response. The small project reproducing the problem. has size of 7.9 MB and I can't actually attach it here. How can i send it you?

Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
Hi Fabio,

Just send it to support@nevron.com . Thank you.


Best Regards,
Nevron Support Team



Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
Hi Fabio,
 
The problem is that the chart control does not have preferred width/height. To solve the problem simply assign some width / height to the chart:
 
Plot.Width = 400;
Plot.Height = 300;  

Let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team



Fabio Olcese
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 11, Visits: 40
Yes that sets up an initial width and height for the plot, but what if I want it to stretch to the current width of the column? For example if I move the gridsplitter to the left you can clearly see it is an static width.

Fabio Olcese
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 11, Visits: 40
I thought that I replied earlier but apparently I didn't. Yes setting up the width and height fixed the issue of the expander not being expanded when you start the project, but what if I want the chart to stretch to the current width of the column. For example if you move the GridSplitter to the left you will see that the chart won't stretch. How can I do this?

Thanks in advance.

Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
Hi Fabio,

We think the problem is that the control did not have a measured size -
overriding the MeasureOverride seems to fix this problem:
protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint)  
{
    return new System.Windows.Size(Math.Min(constraint.Width, 400), Math.Min(constraint.Height, 300));   
}
this fix will be available in the upcoming release.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic