次のように、チェックボックス ischecked を xaml の別の要素にバインドできます
<CheckBox IsChecked="{Binding ElementName=textEditor,Path=WordWrap}">
<TextEditor Grid.Row="1"
Name="textEditor"
FontFamily="Consolas"
FontSize="10pt"
SyntaxHighlighting="JavaScript">
</TextEditor>
それはうまく機能しますが、何らかの理由でC#コード内にtexteditorを作成してcontentpresenter内に配置したいのですが、その後バインディングが期待どおりに機能しません。
<ContentPresenter Name="CpTextEditor" Grid.Row="1" Content="{Binding TextEditor}">
</ContentPresenter>
TextEditor = new TextEditor()
{
Name = "TextEditor",
FontFamily = new FontFamily("Consolas"),
FontSize = 14,
ShowLineNumbers = true,
WordWrap = false,
};
問題を解決する方法はありますか?ありがとう