Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
XamPropertyGrid bound to PropertyGridPropertyItem(s)
posted

Is there a way to bring the SelectedItem item into focus in the property grid after being set.  

The Grid in xaml below:

<igProp:XamPropertyGrid x:Name="XamPropertyGrid" Grid.Row="1" Grid.Column="2" Margin="2,0,0,3" NameColumnWidth="350" AllowDrop="True" 
SelectedObject="{Binding ElementName=SpSmTreeView2, Path=ActiveDataItem}" 
SelectedItem="{Binding Path=DataContext.SelectedProperty, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" >

private PropertyGridPropertyItem _selectedProperty;
public PropertyGridPropertyItem SelectedProperty
{
get
{
return _selectedProperty;
}
set
{
if (_selectedProperty != value)
{
_selectedProperty = value;
RaisePropertyChanged(() => SelectedProperty);
}
}
}

Also, is the following code the propert way to set the SelectedProperty when the grid is bound to PropertyGridPropertyItem(s)

var PropertyGridPropertyItem = new PropertyGridPropertyItem(SelectedBluePrintObject as BluePrintViewModel, theMissingSPPropertyName, theSPProperty.CategoryName, typeof(String), theSPProperty.IsReadOnly, false);
SelectedProperty = PropertyGridPropertyItem;

Any help will be appreciated.  Also, is there a way to insert code snippets with better formatting?  Thank you,

Andy