0

I tried to change color of marks on axis (small lines near numbers), but it didn't change them, instead they just disappear. Here is what I've tried:

<DVC:Chart.Axes>
            <DVC:LinearAxis Orientation="X" Title="Id" Foreground="White"/>
            <DVC:LinearAxis Orientation="Y" Location="Left" Title="Value" Foreground="White">
                <DVC:LinearAxis.MajorTickMarkStyle>
                    <Style TargetType="Line">
                        <Setter Property="Control.Background" Value="Green" />
                        <Setter Property="Control.Foreground" Value="White" />
                        <Setter Property="Control.BorderBrush" Value="#FFFFA500" />
                        <Setter Property="Control.BorderThickness" Value="1" />
                        <Setter Property="Stroke" Value="Green"/>
                        <Setter Property="StrokeThickness" Value="1"/>
                    </Style>
                </DVC:LinearAxis.MajorTickMarkStyle>
            </DVC:LinearAxis>
</DVC:Chart.Axes>
Pie
  • 61
  • 1
  • 5
  • Redefining `Style` will reset all other properties (control template, visibility, etc.), unless you use `BasedOn` to [inherit base style](https://stackoverflow.com/q/11581475/1997232). – Sinatr Sep 18 '20 at 07:11
  • What type should i write because I tried ` – Pie Sep 18 '20 at 07:30
  • [This error](https://stackoverflow.com/q/35852051/1997232) or which? I am afraid that may be the question to library developers. What is `DVC`? Consider to tag question with library tag, that might help to get their attention. – Sinatr Sep 18 '20 at 07:40
  • Another possibility is to [extract default control template](https://stackoverflow.com/q/8825030/1997232) and just modify properties you need. – Sinatr Sep 18 '20 at 07:44

1 Answers1

0

After a deep 1 hour of searching the solution, I found this:

App.xaml

        <Style x:Key="WhiteTickMarkX" TargetType="Line">
            <Setter Property="Stroke" Value="White" />
            <Setter Property="StrokeThickness" Value="1" />
            <Setter Property="X1" Value="-1" />
            <Setter Property="X2" Value="6" />
            <Setter Property="Fill" Value="White" />
        </Style>

        <Style x:Key="WhiteTickMarkY" TargetType="Line">
            <Setter Property="Stroke" Value="White" />
            <Setter Property="StrokeThickness" Value="1" />
            <Setter Property="Y1" Value="-1" />
            <Setter Property="Y2" Value="6" />
            <Setter Property="Fill" Value="White" />
        </Style>

X1 and X2 means a horizontal line and Y1 and Y2 means a vertical line.

MajorTickMarkStyle="{StaticResource WhiteTickMarkY}"
MajorTickMarkStyle="{StaticResource WhiteTickMarkX}"

Hope this helps. I've tested on one of my projects, and works fine.

radoczsanyi_
  • 86
  • 1
  • 5