Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: PropertyGrid items initially collapsed when using .Net 3.5 binaries [21967]

$
0
0
When using the PropertyGrid, all properties are shown initially collapsed.
This problem only occurs when using the latest (version 2.5) binaries for .Net 3.5. If I switch to the .Net 4.x binaries, the properties are expanded as expected.

Presumably this is a bug in the .Net 3.5 binaries? Is there any way to work around the issue?

Thanks,

--- John.
Comments: ** Comment from web user: BoucherS **

Hi,

Sorry about that.

The bug is present in
-v2.5 "Community edition" for .net 3.5
-v2.6 "Community Edition" for .net 3.5
but is fixed in
-v2.7 "Community edition" for .net 3.5.

(It is correct in all v2.X "Plus edition" for .net 3.5 and .net 4.X).

There are just a few users of the Extended Toolkit for .net 3.5, so the bug wasn't reported earlier.

Yes, you found the part that needs to be fixed in v2.5 for .net 3.5.

Here's a possible workaround if you only use the dll and don't update the code. :
1) Override a PropertyGrid :
```
public class MyPropertyGrid : PropertyGrid
{
public override void OnApplyTemplate()
{
base.OnApplyTemplate();

var pic = GetTemplateChild( "PART_PropertyItemsControl" ) as PropertyItemsControl;
if( pic != null )
{
pic.GroupStyle.Clear();
pic.GroupStyle.Add( this.Resources[ "PropertyItemGroupStyle" ] as GroupStyle );
}
}
}
```

and in XAML, set the Expander to be expanded by default :
```
<local:MyPropertyGrid x:Name="_propertyGrid"
Width="450"
MaxHeight="245"
Margin="10"
AutoGenerateProperties="True">
<local:MyPropertyGrid.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Xceed.Wpf.Toolkit;component/PropertyGrid/Themes/Aero2.NormalColor.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="PropertyItemGroupContainerStyle"
TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border>
<Expander Header="{Binding Name}"
Style="{StaticResource ExpanderStyle}"
IsExpanded="True">
<ItemsPresenter />
</Expander>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>

<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Name}"
Value="Misc" />
<Condition Binding="{Binding IsMiscCategoryLabelHidden, RelativeSource={RelativeSource AncestorType={x:Type xctk:PropertyGrid}}}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<!-- No Expander for the Misc Category -->
<ItemsPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</MultiDataTrigger>
</Style.Triggers>
</Style>

<GroupStyle x:Key="PropertyItemGroupStyle"
ContainerStyle="{StaticResource PropertyItemGroupContainerStyle}" />

</ResourceDictionary>
</local:MyPropertyGrid.Resources>
</local:MyPropertyGrid>
```


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>