I have a property which needs to obtain the physical path of the file to open it. I am getting the path using the following XML Code:
</xctk:PropertyGrid.PropertyDefinitions>
<xctk:PropertyGrid.EditorDefinitions>
<xctk:EditorDefinition>
<xctk:EditorDefinition.PropertiesDefinitions>
<xctk:PropertyDefinition Name="ImagePath" />
</xctk:EditorDefinition.PropertiesDefinitions>
<xctk:EditorDefinition.EditorTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBox x:Name="ImgTxt" Grid.Column="0" Text="{Binding ElementName=ImgBtn, Path=Tag}"></TextBox>
<Button x:Name="ImgBtn" Grid.Column="1" Content="..." Click="ButtonBase_OnClick"></Button>
</Grid>
</DataTemplate>
</xctk:EditorDefinition.EditorTemplate>
</xctk:EditorDefinition>
</xctk:PropertyGrid.EditorDefinitions>
The C# code to handle click of button is:
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
var openFile = new OpenFileDialog { Filter = "Icons (*.png)|*.png|All Files (*.*)|*.*" };
if (openFile.ShowDialog() == true)
{
((FrameworkElement)(e.OriginalSource)).Tag = openFile.FileName;
}
}
But I am not able to update the property "ImagePath" value with the recieved path.
Comments: Not a bug
</xctk:PropertyGrid.PropertyDefinitions>
<xctk:PropertyGrid.EditorDefinitions>
<xctk:EditorDefinition>
<xctk:EditorDefinition.PropertiesDefinitions>
<xctk:PropertyDefinition Name="ImagePath" />
</xctk:EditorDefinition.PropertiesDefinitions>
<xctk:EditorDefinition.EditorTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBox x:Name="ImgTxt" Grid.Column="0" Text="{Binding ElementName=ImgBtn, Path=Tag}"></TextBox>
<Button x:Name="ImgBtn" Grid.Column="1" Content="..." Click="ButtonBase_OnClick"></Button>
</Grid>
</DataTemplate>
</xctk:EditorDefinition.EditorTemplate>
</xctk:EditorDefinition>
</xctk:PropertyGrid.EditorDefinitions>
The C# code to handle click of button is:
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
var openFile = new OpenFileDialog { Filter = "Icons (*.png)|*.png|All Files (*.*)|*.*" };
if (openFile.ShowDialog() == true)
{
((FrameworkElement)(e.OriginalSource)).Tag = openFile.FileName;
}
}
But I am not able to update the property "ImagePath" value with the recieved path.
Comments: Not a bug