Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Columnseries question & theme question
1 replies. Latest Post by Mog Liang - MSFT on July 1, 2009.
(0)
WtFudgE
Member
3 points
21 Posts
06-26-2009 3:31 AM |
Hi, I have some layout questions, my databindings worked excellent, so great job guys!The thing is, I am using a couple of charts, and I want them to stretch themself according to the page, this works horizontally, but not vertically. I use the following xaml code: <Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width=".5*" /> <ColumnDefinition Width=".5*" /> </Grid.ColumnDefinitions> <StackPanel Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10"> <chartingToolkit:Chart x:Name="columnChart1"> <chartingToolkit:Chart.LegendStyle> <Style TargetType="Control"> <Setter Property="Width" Value="0"/> <Setter Property="Height" Value="0"/> </Style> </chartingToolkit:Chart.LegendStyle> <chartingToolkit:Chart.Series> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> </chartingToolkit:Chart.Series> </chartingToolkit:Chart> </StackPanel> <StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10"> <chartingToolkit:Chart x:Name="columnChart2"> <chartingToolkit:Chart.LegendStyle> <Style TargetType="Control"> <Setter Property="Width" Value="0"/> <Setter Property="Height" Value="0"/> </Style> </chartingToolkit:Chart.LegendStyle> <chartingToolkit:Chart.Series> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> </chartingToolkit:Chart.Series> </chartingToolkit:Chart> </StackPanel> What am I doing wrong? By the way, I have one other question. Does some1 have the code of the backgroundgradient of the shiny blue theme? I need to make the same background colour. Or is there a way to override the colors shiny blue theme gives to Charts? (Cuz they're ugly as hell :P) Thanks gosu's
Mog Lian...
All-Star
15894 points
1,541 Posts
07-01-2009 4:48 AM |
Remove StackPanel and put two chart in Grid is OK. By default, control will fill the grid
<Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width=".5*" /> <ColumnDefinition Width=".5*" /> </Grid.ColumnDefinitions> <!--<StackPanel Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10">--> <chartingToolkit:Chart x:Name="columnChart1"> <chartingToolkit:Chart.LegendStyle> <Style TargetType="Control"> <Setter Property="Width" Value="0"/> <Setter Property="Height" Value="0"/> </Style> </chartingToolkit:Chart.LegendStyle> <chartingToolkit:Chart.Series> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> </chartingToolkit:Chart.Series> </chartingToolkit:Chart> <!--</StackPanel>--> <!--<StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10">--> <chartingToolkit:Chart x:Name="columnChart2" Grid.Column="1"> <chartingToolkit:Chart.LegendStyle> <Style TargetType="Control"> <Setter Property="Width" Value="0"/> <Setter Property="Height" Value="0"/> </Style> </chartingToolkit:Chart.LegendStyle> <chartingToolkit:Chart.Series> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> <chartingToolkit:ColumnSeries IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> </chartingToolkit:Chart.Series> </chartingToolkit:Chart> <!--</StackPanel>-->