I have a tab control with two tab items. In each tab item I have a TChart control that is supposed to stretch to fill the tab item. If I assign a fixed size to the TChart control in the first tab, then the TChart in the second tab will automatically stretch. If I try to make them both stretchable, then the designer preview fails. If I replace the TChart control in the first tab item with a simple button, the button correctly stretches and so does the TChart control in the second tab item. I have tried all kinds of variations but I cannot get both TChart controls to stretch automatically. See attached code. Remove the hard coded dimensions of the first TChart control to reproduce the problem.
Can you help?
Thanks,
Kent
Code: Select all
<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="SilverlightTestApplication.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
xmlns:my="clr-namespace:Steema.TeeChart.Silverlight;assembly=TeeChart.Silverlight">
<Grid x:Name="gridChart" Background="LightBlue" Margin="10,10,10,10">
<Grid.RowDefinitions>
<RowDefinition MinHeight="10" />
<!---Name="rowListView"-->
<!--- listbox/filters -->
<RowDefinition Height="auto"/>
<!--- Splitter -->
<RowDefinition MinHeight="200"/>
<!--- Chart -->
<RowDefinition Height="26"/>
<!--- Toolbar -->
<RowDefinition Height="26"/>
<!--- Tool panel -->
</Grid.RowDefinitions>
<controls:TabControl Grid.Row="0" Name="tabTools" >
<controls:TabItem Header="Filters" Name="tabItemToolsFilter" >
</controls:TabItem>
<controls:TabItem Header="Device Information" Name="tabItemToolsDeviceInfo" >
<!---ToolTip="Display device information"-->
</controls:TabItem>
<controls:TabItem Header="Notepad" Name="tabItemToolsNotepad" >
<!---ToolTip="Import/Export chart data"-->
</controls:TabItem>
</controls:TabControl>
<controls:GridSplitter Grid.Row="1" Name="gridSplitterChart" Height="10"
VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
<!---ResizeDirection="Auto"-->
<controls:TabControl Grid.Row="2" Name="tabControlChart" >
<!--SelectionChanged="tabControlChart_SelectionChanged"-->
<controls:TabItem Header="ITI (CBEMA)" Name="tabItemCBEMA">
<StackPanel>
<Button Content="button 1"/>
<!--<my:TChart Name="tChart1" Height="420" Width="620" Margin="0,0,0,0"></my:TChart>-->
<my:TChart Name="ChartHMICBEMA" Height="420" Width="620" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" />
<!-- GetAxisLabel="ChartHMIDisplay_GetAxisLabel" GetNextAxisLabel="ChartHMIDisplay_GetNextAxisLabel" ClickLegend="ChartHMIDisplay_ClickLegend" -->
<!---MouseDown="ChartHMICBEMA_MouseDown" MouseUp="ChartHMICBEMA_MouseUp" MouseWheel="ChartHMICBEMA_MouseWheel" MouseMove="ChartHMICBEMA_MouseMove"-->
</StackPanel>
</controls:TabItem>
<controls:TabItem Header="VSSI" Name="tabItemChart">
<!--<my:TChart Name="ChartHMIDisplay" Height="420" Width="620" Margin="0,0,0,0"></my:TChart>-->
<my:TChart Name="ChartHMIDisplay" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" />
<!-- GetAxisLabel="ChartHMIDisplay_GetAxisLabel" GetNextAxisLabel="ChartHMIDisplay_GetNextAxisLabel" ClickLegend="ChartHMIDisplay_ClickLegend"-->
<!---MouseDown="ChartHMICBEMA_MouseDown" MouseUp="ChartHMICBEMA_MouseUp" MouseMove="ChartHMICBEMA_MouseMove" MouseWheel="ChartHMICBEMA_MouseWheel"-->
</controls:TabItem>
</controls:TabControl>
</Grid>
</UserControl>