FileName Property

7 posts, 0 answers
  1. David
    David avatar
    27 posts
    Member since:
    Apr 2013

    Posted 26 Apr 2013 Link to this post


    This seems like it would be a common issue but I have not been able to find a reference in either the documentation or forums. I have a class that I want to edit using the RadPropertyGrid and one of the public properties is a string that contains a file path. I want to use the OpenFileDialog (or equivalent) to edit this property. Any help would be appreciated...

    Thanks
    Dave Goughnour
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 01 May 2013 Link to this post

    Hello,

     Please excuse us for the delayed answer. Basically, RadPropertyGrid does not have such default editor, but you can easily customize it. Here is an article that illustrates how to assign your own editors to the fields. I guess that you need some button which displays OpenFIleDialog when gets clicked. Please, do not hesitate to ask for additional assistance in case it is needed.

    Regards,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 03 Jun 2013 Link to this post

    I've tried many property grids in my days, and most of them have this functionality. Why not implement it for Q2?
  5. David
    David avatar
    27 posts
    Member since:
    Apr 2013

    Posted 03 Jun 2013 Link to this post

    I should have replied a while ago. Turns out this is really easy using a template (I used a template selector since I had a number of other properties that I wanted custom editors for as well. The XAML is:
    <Grid.Resources>
        <local:PropertyGridTemplateSelector x:Key="dataTemplateSelector">
            <local:PropertyGridTemplateSelector.FilenamePropertyTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBox Text="{Binding FilePath}" Grid.Column="0"/>
                        <Button Content="..." Width="25" Height="25" Grid.Column="1" Click="SelectFileClick"/>
                    </Grid>
                </DataTemplate>
            </local:PropertyGridTemplateSelector.FilenamePropertyTemplate>
            <!-- More templates here -->
        </local:PropertyGridTemplateSelector>
    </Grid.Resources>

    Obviously the SelectFileClick handler displays the OpenFileDialog...
  6. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 03 Jun 2013 Link to this post

    Ah, thanks a lot!!
  7. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 04 Jun 2013 Link to this post

    Do I have to specify a data template for all data types? Ideally, I would inherit Telerik's implementation and add support for certain Filename properties.
  8. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 06 Jun 2013 Link to this post

    Hello Guys,

    @David, Thank you for posting this sample code.
    @Kristoffer, our current policy towards RadPropertyGrid is to make it easily customizable, so that clients can adapt it for their custom needs. We have default editors for the most common types and we implement such for the most popular feature request, but we have never had considerable demand for filename editor. We will consider it for the future releases, in case it gains popularity.

    Regards,
    Ivan Ivanov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready