简体   繁体   中英

WPF toolkit ColorPicker in DataGrid lost focus

I have a WPF DataGrid with a ColorPicker column. All works fine, but when the user try to click on the advanced button (see picture), the ColorPicker close.

在此处输入图片说明

When the user click again in the column, the ColorPicker opens and suddenly the "Advanced" button works. But when he click on a other column, it opens, he want click the advanced button, the ColorPicker close.

Here is the code of the DataTemplate in XAML file

             <DataGridTemplateColumn.CellTemplate>
              <DataTemplate>
                <xceed:ColorPicker SelectedColor="{Binding Color, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, Converter={StaticResource StringToWindowsMediaColorConverter}}" />
              </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>

Any suggestions, how can I fix this issue? Thank you.

I had this problem too. I made the following workaround.

I bind the IsOpen Property of the ColorPicker to a new Property. Then I add a new column to the grid. In this column, I put a new button which pushes the IsOpen Property. I set the column with the ColorPicker on IsEnabled = false . So the only way to open the picker is the button-column. When the ColorPicker is openened by the button, it works normally and stays open until a color is clicked. Switching between the standard and advanced is no problem.

To create a new column to open the colorpicker is not nice, but I found no other solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM