Home Forums WPF controls Xceed Toolkit Plus for WPF ColorPicker DependencyProperty.UnsetValue exception if used in ListView item

Mots-clés : 

2 sujets de 1 à 2 (sur un total de 2)
  • Auteur
    Messages
  • peterj
    Participant
    Post count: 5
    #50073 |

    Hi,

    We’ve found a slightly odd one – if we place the Colorpicker directly on a WPF Window then it works fine, but if we place it in a GridViewColumn in an ListView then our applications fails at runtime with :

    System.Windows.Markup.XamlParseException: '{DependencyProperty.UnsetValue}' is not a valid value for property 'DropDownBackground'.
       at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)

    Our ListView is pretty standard, and we are showing the color picker in one of the columns (see below) – we have worked around this by expressly setting the DropDownBackground to a brush, and then it works fine.

    Also, bizarely, it doesn’t occur on all Systems – Windows 10 seems fine, Windows 7 seems more likely to do it, but we’ve had reports that seem to be more widespread, so the OS might be a red herring.

    <ListView ItemsSource="{Binding Attributes}" Margin="5,0,0,0" >
     <GridViewColumn Header="Back Colour" Width="100" >
      <GridViewColumn.CellTemplate>
       <DataTemplate >
        <DockPanel>
         <xctk:ColorPicker SelectedColor="{Binding BackColor}"/>
        </DockPanel>
       </DataTemplate>
      </GridViewColumn.CellTemplate>
     </GridViewColumn>
    </ListView>

    Is it something we are obviously getting wrong?

    Thanks

    Diane [Xceed]
    Modérateur
    Post count: 1353

    Hi peterj,

    Yes this is a known issue, the bug will not happen on Windows 8 and up. Other OS however might have the problem.

    It has already been fixed, and the fix will be included in the next release (v3.7).

    In the meantime, if you have access to the code, you can use the following Brush for the DropDownBackground property in the style for « ColorPicker », in file Xceed.Wpf.Toolkit/ColorPicker/Themes/Generic.xaml :

       <Setter Property="DropDownBackground">
          <Setter.Value>
             <LinearGradientBrush EndPoint="0.5,1"
                                  StartPoint="0.5,0">
                <GradientStop Color="#FFFAFBFB"
                              Offset="0" />
                <GradientStop Color="#FFF4F4F4"
                              Offset="1" />
             </LinearGradientBrush>
          </Setter.Value>
       </Setter>
2 sujets de 1 à 2 (sur un total de 2)
  • Vous devez être connecté pour répondre à ce sujet.