0

How can i make like a this:

<Color x:FactoryMethod="FromRgb">
    <x:Arguments >
        <x:Double x:Key="{Binding Source={x:Reference SliderR}}"/>
        <x:Double x:Key="{Binding Source={x:Reference SliderG}}"/>
        <x:Double x:Key="{Binding Source={x:Reference SliderB}}"/>
    </x:Arguments>
</Color>

But i think that primitive type does nor support binding function.

Cheesebaron
  • 24,131
  • 15
  • 66
  • 118
Nikita Goncharuk
  • 795
  • 1
  • 8
  • 23
  • Why you do not want to use IMultiValueConverter like here: https://stackoverflow.com/questions/29678176/how-can-i-convert-the-values-of-three-sliders-into-a-color – macieqqq Jan 09 '18 at 14:26
  • 2
    I'm afraid you've gone pretty far in the wrong direction. You cannot set bindings on arguments, because the `Color` instance is only created once; you can't update a constructor argument after the fact. Additionally, you can only set a `Binding` on a _dependency property_, which `x:Key` is not. In fact, it's not a property at all; it's a special member used to specify a dictionary key, and you can only use it on elements that are children of a dictionary object (like a `ResourceDictionary`). Check the link @macieqqq provided, as it will show you how to approach the problem correctly. – Mike Strobel Jan 09 '18 at 14:57
  • And what's the exactly application you are developing? UWP or WPF ? – Sunteen Wu Jan 10 '18 at 02:34
  • Xamarin app. Sorry for x: The key, I just checked it and also know what that means. But can I completely abandon the code and how do I anchor the element's color to the 3 values of the Slider object? I know that I can make my own markup extension and this will work, but is it possible without it? – Nikita Goncharuk Jan 10 '18 at 20:17

0 Answers0