0

I am writing a Windows Phone Application (WinRT 8.1).

I added a Piechart from WinRT XAML Toolkit having 6 items in it. The default PieChart has only 3 colors. So, I added 6 ResourceDictionaries in it. The index of this PieChart is in 6 colors but PieChart is still showing in 3 colors.

Screenshot: Uploaded ScreenShot

XAML:

<Charting:Chart Name="Question">
    <Charting:Chart.Palette>
        <Charting:ResourceDictionaryCollection>

        <!-- Lemon Green -->
            <ResourceDictionary>
                <SolidColorBrush
                x:Key="Background"
                Color="#FFA5C127" />
                <Style
                x:Key="DataPointStyle"
                TargetType="Control">
                <Setter
                Property="Background"
                Value="{StaticResource Background}" />
                </Style>
                <Style
                x:Key="DataShapeStyle"
                TargetType="Shape">
                <Setter
                Property="Stroke"
                Value="{StaticResource Background}" />
                <Setter
                Property="StrokeThickness"
                Value="2" />
                <Setter
                Property="StrokeMiterLimit"
                Value="1" />
                <Setter
                Property="Fill"
                Value="{StaticResource Background}" />
                </Style>
            </ResourceDictionary>
            <!-- Blue -->
                <ResourceDictionary>
                <SolidColorBrush
                x:Key="Background"
                Color="#FF0E749B" />
                <Style
                x:Key="DataPointStyle"
                TargetType="Control">
                <Setter
                Property="Background"
                Value="{StaticResource Background}" />
                </Style>
                <Style
                x:Key="DataShapeStyle"
                TargetType="Shape">
                <Setter
                Property="Stroke"
                Value="{StaticResource Background}" />
                <Setter
                Property="StrokeThickness"
                Value="2" />
                <Setter
                Property="StrokeMiterLimit"
                Value="1" />
                <Setter
                Property="Fill"
                Value="{StaticResource Background}" />
                </Style>
            </ResourceDictionary>

        <!-- Red -->
            <ResourceDictionary>
                <SolidColorBrush
                x:Key="Background"
                Color="#FFA60606" />
                <Style
                x:Key="DataPointStyle"
                TargetType="Control">
                <Setter
                Property="Background"
                Value="{StaticResource Background}" />
                </Style>
                <Style
                x:Key="DataShapeStyle"
                TargetType="Shape">
                <Setter
                Property="Stroke"
                Value="{StaticResource Background}" />
                <Setter
                Property="StrokeThickness"
                Value="2" />
                <Setter
                Property="StrokeMiterLimit"
                Value="1" />
                <Setter
                Property="Fill"
                Value="{StaticResource Background}" />
                </Style>
            </ResourceDictionary>

        <!-- Green -->
            <ResourceDictionary>
                <SolidColorBrush
                x:Key="Background"
                Color="#FF54BD0B" />
                <Style
                x:Key="DataPointStyle"
                TargetType="Control">
                <Setter
                Property="Background"
                Value="{StaticResource Background}" />
                </Style>
                <Style
                x:Key="DataShapeStyle"
                TargetType="Shape">
                <Setter
                Property="Stroke"
                Value="{StaticResource Background}" />
                <Setter
                Property="StrokeThickness"
                Value="2" />
                <Setter
                Property="StrokeMiterLimit"
                Value="1" />
                <Setter
                Property="Fill"
                Value="{StaticResource Background}" />
                </Style>
            </ResourceDictionary>

        <!-- Sky Blue -->
            <ResourceDictionary>
                <SolidColorBrush
                x:Key="Background"
                Color="#FF08A4DE" />
                <Style
                x:Key="DataPointStyle"
                TargetType="Control">
                <Setter
                Property="Background"
                Value="{StaticResource Background}" />
                </Style>
                <Style
                x:Key="DataShapeStyle"
                TargetType="Shape">
                <Setter
                Property="Stroke"
                Value="{StaticResource Background}" />
                <Setter
                Property="StrokeThickness"
                Value="2" />
                <Setter
                Property="StrokeMiterLimit"
                Value="1" />
                <Setter
                Property="Fill"
                Value="{StaticResource Background}" />
                </Style>
            </ResourceDictionary>

        <!-- Dark Brown -->
            <ResourceDictionary>
                <SolidColorBrush
                x:Key="Background"
                Color="#FF3A0401" />
                <Style
                x:Key="DataPointStyle"
                TargetType="Control">
                <Setter
                Property="Background"
                Value="{StaticResource Background}" />
                </Style>
                <Style
                x:Key="DataShapeStyle"
                TargetType="Shape">
                <Setter
                Property="Stroke"
                Value="{StaticResource Background}" />
                <Setter
                Property="StrokeThickness"
                Value="2" />
                <Setter
                Property="StrokeMiterLimit"
                Value="1" />
                <Setter
                Property="Fill"
                Value="{StaticResource Background}" />
                </Style>
            </ResourceDictionary>

        </Charting:ResourceDictionaryCollection>
    </Charting:Chart.Palette>

    <Charting:PieSeries 
    IndependentValuePath="Item1"
    DependentValuePath="Item2" 
    IsSelectionEnabled="False"/>
</Charting:Chart>

C#:

List<Tuple<string, int>> QuestionList = new List<Tuple<string, int>>()
{
    new Tuple<string, int>(Str1, v1),
    new Tuple<string, int>(Str2, v2)

};

Question.Title = "Pie Chart";
(Question.Series[0] as PieSeries).ItemsSource = QuestionList;
Atif Shabeer
  • 553
  • 6
  • 18

1 Answers1

0

Rebuild the Project. Remove testing app from mobile. Reinstall the app.

Atif Shabeer
  • 553
  • 6
  • 18
  • Did you meant to say that rebuilding (+ the other steps) fixed the problem? I have seen C++/XAML projects having problems recompiling their XAML, when nothing changed in code behind but it seems like you're using C#. Which Visual Studio release are you using? Did you use Nuget to grab the toolkit? – Filip Skakun Jul 20 '15 at 15:30