I have a UserControl
which has a property Theme
. The Theme
is just an Enum
of ElementTheme
.
public sealed partial class PlaylistControl : UserControl, MediaControlListener
{
public ElementTheme Theme { get; set; }
public static readonly DependencyProperty ThemeProperty = DependencyProperty.Register("Theme", typeof(ElementTheme), typeof(PlaylistControl), new PropertyMetadata(null));
...
}
And inside the xaml of that control, I have a TextBlock
whose Foreground
is Foreground="{x:Bind IsPlaying, Converter={StaticResource RowColorConverter}, ConverterParameter={Binding Theme}, Mode=OneWay}"
However, the converter doesn't seem to get the theme. It is always null.
class RowColorConverter : Windows.UI.Xaml.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return value.Equals(true) ? Helper.GetHighlightBrush() :
parameter is ElementTheme && (ElementTheme)parameter == ElementTheme.Dark ? Helper.WhiteSmokeBrush : Helper.BlackBrush;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return null;
}
}
What is wrong?