File browsing

Grids for WPF Forum

Posted 11 years ago by Sasha
Version: 13.1.0582
Avatar

Hi,  I create dynamically properties for propertyGrid in a following way:

 

[LocalizedCategory("General")]
[LocalizedDisplayName("DisplayControlName")]
[LocalizedDescription("DescControlName")]
public string TabTitle
{
    get { return _tabTitle; }
    set
    {
        _tabTitle = value;
        RaisePropertyChanged("TabTitle");
    }
}

 And I want to do file browsing with one of my properties. How can I add only to one specific property textbox and popupbutton like in tutorial Property Editors?

Thank you in advance

[Modified 11 years ago]

Comments (4)

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Sasha,

You can stick something like this in your PropertyGrid.PropertyEditors collection:

<propgrid:DialogTextBoxPropertyEditor PropertyName="TabTitle" />

Then it will show a TextBox with a dialog box button.  This button fires a PropertyGrid.ShowPropertyDialogCommand when it is clicked, so just add a command binding to that on your containing view and handle the dialog show there.

this.CommandBindings.Add(new CommandBinding(PropertyGrid.ShowPropertyDialogCommand, OnShowPropertyDialogExecute));


Actipro Software Support

Posted 11 years ago by Sasha
Avatar

Im sory, I didnot understand where should I add this line:

<propgrid:DialogTextBoxPropertyEditor PropertyName="TabTitle" />

 In my Xaml file in ResourceDictionary I have style with converter, to expand one category:

 <Style TargetType="{x:Type propgrid:PropertyGridDataAccessorItem}">
                <Style.Triggers>
                    <Trigger Property="DataAccessorType" Value="Category">
                        <Setter Property="IsExpanded">
                            <Setter.Value>
                                <MultiBinding>
                                    <MultiBinding.Converter>
                                        <local:ExpandedCategoryConverter />
                                    </MultiBinding.Converter>
                                    <Binding Path="DisplayName" RelativeSource="{RelativeSource Self}"/>
                                    <Binding Path="ViewModel" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=Window}"/>
                                </MultiBinding>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>

 and here place where I create propertyGrid: 

<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Dock="Bottom">
  <propgrid:PropertyGrid x:Uid="PropertiesUserControl" x:Name="PropertiesUserControl"  IsSummaryVisible="True" 
       AreNestedCategoriesSupported="True" IsAsynchronous="True" IsEnabled="True" AreDefaultSortDescriptionsEnabled="False" 
       AreCategoriesAutoExpanded="False" SelectedObject="{Binding SelectedObject}">      
  </propgrid:PropertyGrid>
</DockPanel>

 And properties to expand I did as in my first question. But where to insert a line that you mentioned I can't figure out

[Modified 11 years ago]

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

You would do it in the collection I mentioned, like:

<propgrid:PropertyGrid ...>
 <propgrid:PropertyGrid.PropertyEditors>
  <propgrid:DialogTextBoxPropertyEditor PropertyName="TabTitle" />
 </propgrid:PropertyGrid.PropertyEditors>
</propgrid:PropertyGrid>


Actipro Software Support

Posted 11 years ago by Sasha
Avatar

Thank you for your help

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.