0
WPFプログラミングが初めてです。ここで私を助けてください。wpfのxmlファイルにテキストボックステキストをバインドする
テキストボックスに入力されたデータをxmlファイルで更新します。ここに私のコードです。
XAML:ここ
<Window.Resources>
<XmlDataProvider x:Key="credential_data" Source="Credentials.xml" XPath="/Credentials/MB"/>
</Window.Resources>
<StackPanel DataContext="{Binding Source={StaticResource credential_data}}">
<TextBox Height="23" Name="textBox5" Width="188" Text="{Binding XPath=Hostname, Mode=TwoWay}"/>
<TextBox Height="23" Name="textBox6" Width="188" Text="{Binding XPath=Port, Mode=TwoWay}"/>
</StackPanel>
がCredentials.xmlです:
<?xml version="1.0" encoding="utf-8"?>
<Credentials>
<MB>
<Hostname>10.111.123.234</Hostname>
<Port>8080</Port>
</MB>
</Credentials>
は今何が起こっているxmlファイル内のすべての更新をテキストボックスに反映されることをであるが、textbox.textの変更xmlファイルは更新されません。
どこが間違っていますか? :(
感謝。
あなたはXMLを意味するか何をしたいまさにを行いチュートリアルプロジェクトを持っていないため**ファイル**すぐに変更されませんか? –