xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.87k stars 872 forks source link

PropertyGrid - Sorting and visual problems. #1389

Open ErrorEater opened 5 years ago

ErrorEater commented 5 years ago

1) The property name sorting should be "none" by default rather than alphabetical. The properties are generally put in logical order by creators, sorting them directly alphabetically is not very convenient. Requires adding ordering attributes which is not possible for some external objects.

2) Search box is quite useless since it can't search recursively the child properties. Recursive search is necessary.

3) In Windows 7 (visuals disabled) the row lines appear thicker and in numeric properties moving the mouse over them causes up/down movement of the rest of the lines due to the added numeric up/down control which is the result of non even row height.

numupdown

4) Scroll mouse button can't make the grid to scroll up/down. It can only be scrolled from vertical scroll bar. Annoying.

5) Would be nice to have some visual properties for easily changing background/foreground colors, row widths etc.

XceedBoucherS commented 5 years ago

Hi,

  1. We will evaluate this.

  2. This is available in the commercial version. You can buy the latest version (v3.7) or try the 45 days free trial here : https://xceed.com/xceed-toolkit-plus-for-wpf/

  3. We can not reproduce this in v3.4. Does the problem persists in the latest version : v3.7 ?

  4. If your mouse is over the PropertyGrid, the mouse wheel will scroll the PropertyGrid. Make sure your PropertyGrid has a fixed Height. <StackPanel> <Button x:Name="_Button" Content="TEST" /> <xctk:PropertyGrid SelectedObject="{Binding ElementName=_Button}" Height="500"/> </StackPanel>

  5. We take note of this. I just want to remind you that buying a Blueprint subscription give you access to the source code to customize the PropertyGrid colors.

evancekafando commented 2 years ago

Hi,

Starting from v4.3.1, you can set the PropertyGrid items Background/Foreground colors by creating a style targeting the xctk:PropertyItem type and use a ValueConverter to apply the color you want to any specific PropertyItem.

Example :

    <local:ColorConverter x:Key="colorConverter" />

    <Style TargetType="xctk:PropertyItem">
      <Setter Property="Background"
              Value="{Binding ., RelativeSource={RelativeSource Self}, Converter={StaticResource colorConverter}}" />
    </Style>

  public class ColorConverter : IValueConverter
  {
    public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
    {
      var propertyItem = value as PropertyItem;
      if( propertyItem != null )
      {
        switch( propertyItem.DisplayName )
        {
          case "String":
            return Brushes.Yellow;
          case "DateTime":
            return Brushes.YellowGreen;
          case "StringCombo":
            return Brushes.Orange;
          default:
            return Brushes.LightSkyBlue;
        }
      }
      return null;
    }

    public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
    {
      throw new NotImplementedException();
    }
  }

Now, if you want to change the PropertyGrid.EditorDefinitions Background/Foreground colors, simply create a style that targets the specific Editor Definition, and set the Background/Foreground via EditingElementStyle proerty :

Example :

    <Style x:Key="dateTimeUpDownStyle"
           TargetType="{x:Type xctk:DateTimeUpDown}">
      <Setter Property="Background"
              Value="YellowGreen" />
    </Style>

        <!-- DateTimeUpDown -->
        <xctk:EditorDateTimeUpDownDefinition TargetProperties="{x:Type s:DateTime}"
                                             Format="Custom"
                                             FormatString="yyyy-MM"
                                             EditingElementStyle="{StaticResource dateTimeUpDownStyle}" />

image