Is there any way to change line color from XAML, not from C#?
<UserControl x:Class="ProceduralWorldGenerator.Views.SplineEditorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:oxy="http://oxyplot.org/wpf"
xmlns:splines="clr-namespace:ProceduralWorldGenerator.ViewModels.Splines"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<splines:SplineEditorViewModel/>
</UserControl.DataContext>
<oxy:PlotView Model="{Binding Plot}" Background="{DynamicResource NodifyEditor.BackgroundBrush}" Foreground="{DynamicResource NodifyEditor.ForegroundBrush}">
<?????? {DynamicResource MyLineBrush}>
</oxy:PlotView>
</UserControl>
I have styles described in ResourceDictionary and It would be nice if my ViewModel just can implement some property like LineBrush and just set it from XAML.
Yes, you can achieve this by defining a DependencyProperty in your UserControl's code-behind (the .cs file) and binding it to your ViewModel's property. Here's how you can do it.
Code-behind:
XAML