-
Notifications
You must be signed in to change notification settings - Fork 491
Description
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
<TabControl.ItemTemplate>
</TabControl.ItemTemplate>
<local:FileSearchViewSelector x:Key="selector" BasicFileMergeTemplate="{StaticResource BasicFileMergeVMTemplate}"
AdvancedFileSearchTemplate="{StaticResource AdvancedFileSearchVMTemplate}" />
AdvancedFileSearchVMTemplate is:
...skip others...
<avalonEdit:TextEditor
x:Name="TextEditor"
Grid.Row="1"
Document="{Binding Document}"
SyntaxHighlighting="{x:Null}"
ShowLineNumbers="True"
WordWrap="False"
FontFamily="Consolas"
FontSize="12"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
behaviors:TextEditorExtension.Register="{Binding RegisterEditorCommand}"
/>
...skip others...
a new tab item (B) is created after the search button was clicked. the backgroud task is runing and update the TextEditor with ::
editor?.BeginChange();
try
{
updateAction?.Invoke();
}
finally
{
editor.EndChange();
if (_autoScroll)
editor.ScrollToEnd();
}
updateAction:
Document.Text = value;
if we switch to tab item A, the system is crashed :
System.InvalidOperationException:“Document is null”
if we dont switch to A, say stay with B, it's ok... we can add code to check if Document is null but it's not the case.
please, any help will be appreciated.