arklumpus / AvaloniaColorPicker

A color picker for Avalonia
GNU Lesser General Public License v3.0
79 stars 6 forks source link

How to get hex of color? #6

Closed INTERNALINTERFERENCE closed 2 years ago

INTERNALINTERFERENCE commented 2 years ago

I try this:

xaml:

avaloniaColorPicker:ColorButton Grid.Row="0" Grid.Column="1" Color="{Binding MyColor}" HorizontalAlignment="Center"></avaloniaColorPicker:ColorButton>

vm:

private Color _myColor = Colors.Aqua;          

public Color MyColor                           
{                                              
    get { return _myColor; }                   
    set                                        
    {                                          
        SetAndRaise( ref _myColor, value );    
    }                                          
}                            

It works fine, I can see Aqua color and even change it. BUT color code doesn't change. If i do this: var a = _myColor.ToString(); I always get Aqua. What am I doing wrong?

INTERNALINTERFERENCE commented 2 years ago

I'm sorry for my stupid question

arklumpus commented 2 years ago

Hi, have you tried using Color="{Binding MyColor, Mode=TwoWay}"?

INTERNALINTERFERENCE commented 2 years ago

thanks for your help!