{"action":"created","issue":{"url":"https://api.github.com/repos/icsharpcode/AvalonEdit/issues/84","repository_url":"https://api.github.com/repos/icsharpcode/AvalonEdit","labels_url":"https://api.github.com/repos/icsharpcode/AvalonEdit/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/icsharpcode/AvalonEdit/issues/84/comments","events_url":"https://api.github.com/repos/icsharpcode/AvalonEdit/issues/84/events","html_url":"https://github.com/icsharpcode/AvalonEdit/issues/84","id":124618194,"node_id":"MDU6SXNzdWUxMjQ2MTgxOTQ=","number":84,"title":"[Feature Request] Make TextEditor.Text a DependencyProperty so you can bind a Property to it","user":{"login":"0x53A","id":4236651,"node_id":"MDQ6VXNlcjQyMzY2NTE=","avatar_url":"https://avatars3.githubusercontent.com/u/4236651?v=4","gravatar_id":"","url":"https://api.github.com/users/0x53A","html_url":"https://github.com/0x53A","followers_url":"https://api.github.com/users/0x53A/followers","following_url":"https://api.github.com/users/0x53A/following{/other_user}","gists_url":"https://api.github.com/users/0x53A/gists{/gist_id}","starred_url":"https://api.github.com/users/0x53A/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0x53A/subscriptions","organizations_url":"https://api.github.com/users/0x53A/orgs","repos_url":"https://api.github.com/users/0x53A/repos","events_url":"https://api.github.com/users/0x53A/events{/privacy}","received_events_url":"https://api.github.com/users/0x53A/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-01-02T23:47:07Z","updated_at":"2018-07-11T15:46:11Z","closed_at":"2016-01-03T20:23:23Z","author_association":"NONE","body":"If you try to add a Binding to TextEditor.Text, the program fails with\n\n```\nException thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll\n\nAdditional information: A 'Binding' cannot be set on the 'Text' property of type 'TextEditor'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.\n```\n\nIf you would be OK with post-processing, the easiest way would probably be to add the NuGet AutoDependencyProperty.Fody(https://www.nuget.org/packages/AutoDependencyProperty.Fody/) and decorate the property with `[AutoDependencyProperty]`. This avoids the 'code noise' of Dependency Properties.\n"},"comment":{"url":"https://api.github.com/repos/icsharpcode/AvalonEdit/issues/comments/404217919","html_url":"https://github.com/icsharpcode/AvalonEdit/issues/84#issuecomment-404217919","issue_url":"https://api.github.com/repos/icsharpcode/AvalonEdit/issues/84","id":404217919,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDIxNzkxOQ==","user":{"login":"mysteryx93","id":8528033,"node_id":"MDQ6VXNlcjg1MjgwMzM=","avatar_url":"https://avatars3.githubusercontent.com/u/8528033?v=4","gravatar_id":"","url":"https://api.github.com/users/mysteryx93","html_url":"https://github.com/mysteryx93","followers_url":"https://api.github.com/users/mysteryx93/followers","following_url":"https://api.github.com/users/mysteryx93/following{/other_user}","gists_url":"https://api.github.com/users/mysteryx93/gists{/gist_id}","starred_url":"https://api.github.com/users/mysteryx93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysteryx93/subscriptions","organizations_url":"https://api.github.com/users/mysteryx93/orgs","repos_url":"https://api.github.com/users/mysteryx93/repos","events_url":"https://api.github.com/users/mysteryx93/events{/privacy}","received_events_url":"https://api.github.com/users/mysteryx93/received_events","type":"User","site_admin":false},"created_at":"2018-07-11T15:46:11Z","updated_at":"2018-07-11T15:46:11Z","author_association":"NONE","body":"There are various solutions posted [here](https://stackoverflow.com/questions/18964176/two-way-binding-to-avalonedit-document-text-using-mvvm) but I don't like any of these solutions. The proposed solutions do indeed cause the string to be reconstructed on every key strike to update the dependency property, leading to performance issues.\r\n\r\nBinding to Document isn't working properly, but even if it was, it means writing the MVVM ViewModel around a UI element which defeats the point of MVVM to be UI agnostic.\r\n\r\nHonestly, I think the best option is to raise 2 events from the ViewModel, one to display text when it's really needed, and one to get text when it's really needed. Perhaps it doesn't even need to be stored in the ViewModel at all.\r\n\r\nThen, would it have been possible to derive TextEditor from the TextBox control to inherit its base features?"}}
{"actor":{"display_login":"mysteryx93"}}