以下是我的代码...到此,我可以得到FolderBrowserDialog Box,但是一旦我从该对话框中选择了任何文件夹并单击“确定”。我没有在“浏览”按钮旁边的文本框中获得所选的FolderPath及其文件夹名称。请纠正我...
View.xaml:
<Grid>....
<TextBox Grid.Column="2" Height="25" IsReadOnly="True"
TextAlignment="Right" VerticalContentAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center"
Width="200"
Text="{Binding ElementName=Mygroups,Path=DataContext.FoldernameWithPath}" />
<Button Grid.Column="4" Content="Browse" Height="25" VerticalAlignment="Bottom" Margin="0,20,0,20" MinWidth="51"
Command="{Binding ElementName=Mygroups,Path=DataContext.OpenFolderCommand}"
CommandParameter="{Binding}" />
</Grid>
答案 0 :(得分:0)
<TextBox Grid.Column="2" Height="25" IsReadOnly="True"
TextAlignment="Right" VerticalContentAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center"
Width="200"
Text="{Binding ElementName=Mygroups,Path=DataContext.FoldernameWithPath,Mode=TwoWay}" />
文本porpert是默认的绑定模式。添加Mode = TwoWay。
答案 1 :(得分:0)
尝试以下OnPropertyChanged函数:
protected void OnPropertyChanged (string propertyName)
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}