arklumpus / AvaloniaColorPicker

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

Not working in Avalonia 11.0.1 #12

Closed Kokoreff081 closed 1 year ago

Kokoreff081 commented 1 year ago

I used your amazing ColorPicker in avalonia 0.10, but after updating avalonia version it broken. Main error is: ColorPickerWnd.axaml.cs(65, 15): [CS0012] The type 'Color' is defined in an unreferenced assembly. You should add a reference to the assembly "Avalonia.Visuals, Version=0.10.0.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b".

Can you make an update to your ColorPicker?

arklumpus commented 1 year ago

Hi, I just pushed version 1.4.0, which requires Avalonia 11.0.1. Let me know if you spot any issues!

Kokoreff081 commented 1 year ago

So, i tried to update to 1.4.0, and found image image SO, is there information about ColorPickerWindow and its properly working implementation?

arklumpus commented 1 year ago

It's working fine for me, you're getting null probably because you're trying to access the members before the call to InitializeComponent. This method is responsible for loading the XAML template and populating the fields, hence you cannot access stuff that has been declared in the XAML code before InitializeComponent is called.

In the constructor, try moving the lines:

var cp = DmxColorPicker;
var cp2 = ...

After the call to this.InitializeComponent();

Kokoreff081 commented 1 year ago

So, it was my mistake, now it working properly. Thanks again!