Skip to main content

Microsoft Silverlight

Answered Question Columnseries question & theme questionRSS Feed

(0)

WtFudgE
WtFudgE

Member

Member

3 points

21 Posts

Columnseries question & theme question

  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 Liang - MSFT
Mog Lian...

All-Star

All-Star

15894 points

1,541 Posts

Answered Question

Re: Columnseries question & theme question

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>-->

 

Mog Liang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities