Hi,
in my XAML I use the following TemplateSelector to have a button beside my "SourceFile" property to open a FileDialog to select a filename:
<local:PropertyGridTemplateSelector x:Key="dataTemplateSelector">
<local:PropertyGridTemplateSelector.SourceFilePropertyTemplate>
<DataTemplate>
<Grid Margin="0,0,2,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding SourceFile}" Grid.Column="0"/>
<Button Content="..." Width="25" Height="25" Grid.Column="1" Click="SelectFileClick"/>
</Grid>
</DataTemplate>
</local:PropertyGridTemplateSelector.SourceFilePropertyTemplate>
<!-- More templates here -->
</local:PropertyGridTemplateSelector>
public class PropertyGridTemplateSelector : DataTemplateSelector
{
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
PropertyDefinition dpi = item as PropertyDefinition;
if (dpi.DisplayName == "SourceFile")
{
return SourceFilePropertyTemplate;
}
return null;
}
public DataTemplate SourceFilePropertyTemplate { get; set; }
}
when I select a file through my file dialog,I want to update the recontrol to reflect the selection I made in my file dialog...
Thank's
Alain