This project is read-only.

is it possible to create browsable TextBox (textbox with button))

Mar 7, 2010 at 1:51 PM

Hi there,

Is it possible to create stuff like I've mentioned in subject ?


it must be text box and from the right side of the text box I would prefer to have the button 'Browse' (FolderBrowserDialog).


Could anyone to tell me is it possible to do and how ?



thank you in advance



Mar 7, 2010 at 2:12 PM

Yes it is posibble.

You can create TypeEditors for special types.

I've also Planed a few more (For Brushes, fonts,...)

You can look how I implemented IntegerTypeEditor and you can do the same for your Property

Mar 7, 2010 at 2:21 PM

Hi J.

Could you please post an example of IntegerTypeEditor here ?

I'll be very thankful :)

thank you in advance


Mar 7, 2010 at 2:24 PM

The IntegerTypeEditor is in the SourceCode.

When you have a Property of type Integer, this Editor is used!

And the Descission which Typeeditor is used for wich Property is made in the PropertyTemplateSelector.cs, and it looks which editors are defined in the wpgtemplates.xaml!

Mar 7, 2010 at 2:39 PM
Edited Mar 7, 2010 at 2:41 PM

I cannot find it (IntegerTypeEditor), could you specify more clearly where exactly I need to look for I..T..E.. ?



Mar 7, 2010 at 3:04 PM

If you have the current soureccode, there will be two files named integertypeeditor!


Mar 7, 2010 at 3:06 PM

probably the version that I have is bit older.

Mar 7, 2010 at 3:09 PM
Edited Mar 7, 2010 at 3:20 PM

i found the last version,


Mar 7, 2010 at 3:11 PM
Edited Mar 7, 2010 at 3:19 PM



Mar 8, 2010 at 10:27 AM

Look at the source code page...

May 13, 2010 at 10:24 AM


Did any body have implement this ?



May 13, 2010 at 11:01 AM


I have done with that long time ago :)

1. Create User Control with text box and button and required functionality need to be created there too.



<UserControl x:Class="Allscripts.NewClientWizard.UI.UserControls.UCBrowsableTextBox"
    <Grid x:Name="browsableGrid">
            <ColumnDefinition Width="350"/>
            <ColumnDefinition Width="*"/>

        <TextBox Name="brTextBox" Grid.Column="0" IsReadOnly="True" Margin="0,0,20,0" FocusVisualStyle= "{x:Null}" TabIndex="0" Focusable="True"/>

        <Button Name="btnBrowseImportFilePath" 
                <DropShadowEffect BlurRadius="5" Color="DarkOrange" />


Code Behind:

    public partial class UCBrowsableTextBox : UserControl
        public UCBrowsableTextBox()
            brTextBox.TextChanged += HandleLostFocus;

        void HandleLostFocus(object sender, RoutedEventArgs e)
            TextBox box = sender as TextBox;
            if (box == null) return;
            SetBrowsableText(browsableGrid.Parent, box.Text);

        public static readonly DependencyProperty BrowsableTextProperty = DependencyProperty.Register("BrowsableTextBox",
                                                                                                      new FrameworkPropertyMetadata
        public string BrowsableTextBox
            set { SetValue(BrowsableTextProperty, value); }
            get { return (string)GetValue(BrowsableTextProperty); }

        public static string GetBrowsableText(DependencyObject dp)
            return dp.GetValue(BrowsableTextProperty) as string;

        public static void SetBrowsableText(DependencyObject dp, string value)
            dp.SetValue(BrowsableTextProperty, value);

        private static void OnBrowsableText(DependencyObject d, DependencyPropertyChangedEventArgs e)
            UCBrowsableTextBox browsableTextBox = d as UCBrowsableTextBox;
            if (browsableTextBox == null) return;
            TextBox tbox = browsableTextBox.brTextBox;
            tbox.Text = GetBrowsableText(d);
        private void btnBrowseImportFilePath_Click(object sender, RoutedEventArgs e)
            FolderBrowserDialog fbDialog = new FolderBrowserDialog
                                                   ShowNewFolderButton = true,
                                                   SelectedPath = brTextBox.Text

            if (fbDialog.ShowDialog() == DialogResult.OK)
                brTextBox.Text = fbDialog.SelectedPath;

2.  Add the following xaml into Generic xaml:

    <DataTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId={x:Type InterfacesModels:PasswordString}}">
        <UserControls:UCBindablePasswordBox Margin="0,0,100,0" Width="330" HorizontalAlignment="Left"
                     PasswordText="{Binding Value.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=true}" 
                     FocusVisualStyle= "{x:Null}" TabIndex="0" Focusable="True"/>

If I'm not forgot to add something - it will be works.


enjoy :)



May 13, 2010 at 11:06 AM

yep, I forgot to add few things:


How to use it ?:


public class LabCorpConfigModel
        #region Constructors

        public LabCorpConfigModel()
            ExportPath = new BrowsableTextBox ();
            ImportPath = new BrowsableTextBox ();

        public LabCorpConfigModel(string name):this()
            Name = name;


        [DisplayName("Export Folder Path:")]
        public BrowsableTextBox ExportPath { get; set; }
        [DisplayName("Import Folder Path:")]
        public BrowsableTextBox ImportPath { get; set; }

where BrowsableTextBox:


 public class BrowsableTextBox
        public String Text { get; set; }

May 13, 2010 at 2:10 PM
Edited May 13, 2010 at 2:58 PM

Thank you :)

FolderBrowserDialog is of System.Windows.Form ?

I came across with these errors

 1 'InterfacesModels' is an undeclared namespace.

 2 The property 'PasswordText' was not found 


Jun 8, 2010 at 11:28 AM

got the same problem... any solutions ?

Jun 8, 2010 at 11:44 AM
Edited Jun 8, 2010 at 11:46 AM

Hi guys,


1. FolderBrowserDialog control is from System.Windows.Forms.

2. InterfaceModels - it was my copy-paste mistake, very sorry for that, use the following xaml instead of posted one:


    <DataTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId={x:Type InterfacesModels:BrowsableTextBox}}">
        <UserControls:UCBrowsableTextBox Margin="0,0,25,0"
                     BrowsableTextBox="{Binding Value.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=false}" 
                     FocusVisualStyle= "{x:Null}" TabIndex="0" Focusable="True"/>



where, "InterfacesModels:" is: xmlns:InterfacesModels="clr-namespace:InterfacesModels;assembly=Allscripts.MigrationWizard.BizEntities".

3. using above things you will skip this automatically :)

If any questions, do not hesitate and contact me asap.

Julian (





Jun 8, 2010 at 11:47 AM


Please, leave a post here in case of solving the problem with my solution.




Jun 9, 2010 at 9:34 AM

thx for your efforts,


I added the following line into the generic header file but he can't find it. Is there a special reference I've to add or sth. ?


xmlns :InterfacesModels="clr-namespace:InterfacesModels;assembly=Allscripts.MigrationWizard.BizEntities"

I never heard of this "MigrationWizard" until today ^^

Jun 9, 2010 at 9:53 AM



First of all, sorry for not clear explanation and code as well.

I thought u'll understand it :) but i'm was wrong :)  


xmlns :InterfacesModels="clr-namespace:InterfacesModels;assembly=Allscripts.MigrationWizard.BizEntities"

1. It was an example from my project, that's why you haven't heard about such thing as MigrationWizard :)))))))))))
You need to put there your own path to the BrowsableTextBox
In my case BrowsableTextBox.cs located in : Allscripts.MigrationWizard.BizEntities (it's project) -> InterfacesModels(it is folder).

Hope it will help you.
If not :)))) Just send me an email, and I'll develop little application.

Jun 9, 2010 at 10:58 AM

Now it's working .. thank you very much for this and sry for my lack of understanding :)

Jun 9, 2010 at 11:06 AM

uhuuu :) congratulation :)


enjoy :)


Best regards,


Jun 9, 2010 at 3:17 PM
I'm still looking to implement UITypeEditor but at the moment I'm verry bussy...