Image not visible in WPF 2015 - c#

I'm having some difficulty getting an image to display in WPF, Visual Studio Community Edition 2015.
The first issue involves a lack of dialog in the "Source" property for the image. WPF Tutorials of VS show a way to browse for the file under the source property.This does not appear to be an option under VS 2015 Community edition. Is there any way to enable this feature? Or is it not enabled in the "Community" edition?
The second issue is, the image is not visible at run time, but visible in the designer. Previous posts suggest to enable the "Build Action" for this image to "Resource". There seems to be number of files to set the Build Action on: If I set the MainWindow.xaml file to BuildAction->Resource I get the following error:
Error CS0103 The name 'InitializeComponent' does not exist in the current context
.... If I try to set any other file to BuildAction->Resource I get the following error:
Markup file is not valid. Specify a source markup file with an .xaml extension.
.. And I seem unable to recover without deleting the solution and starting from scratch.
Here is the XAML code
<Window x:Class="WR.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Demo" Height="350" Width="300" >
<Grid>
<ListBox Name="DemoListBox" Margin="15">
<Image x:Name="Image1" Source="/resources/facebook.png">
</Image>
</ListBox>
</Grid>
Thanks in advance

BuildAction->Resource should be set for file facebook.png

Related

Navigation Failed. Cannot Locate Resource for ModernTab WPF

I am using ModernUI in my application. In the code below, I have a link "General" in ModernTab which is inside a window PriceSettingsView in a project PriceSettingsUI. When I run this application the PriceSettingsView window is shown and the link "General" is also working fine, but when I use PriceSettingsView in another project (calling from menu click event), the PriceSettingView window is showing up but the "General" link displays the following error message:
Navigation Failed. Cannot locate resource
Can someone please suggest why it is not working when calling the view from another project? Is something wrong with the source attribute when calling the view from another project?
<mui:ModernWindow x:Class="PriceSettingsUI.PriceSettingsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
mc:Ignorable="d"
Style="{StaticResource EmptyWindow}" Title="PriceSettingsView" Height="700" Width="900">
<Border Margin="0,5,0,0" BorderBrush="{StaticResource Accent}" BorderThickness="1">
<mui:ModernTab>
<mui:ModernTab.Links>
<mui:Link DisplayName="General" Source="/Views/GeneralSettings.xaml"/>
</mui:ModernTab.Links>
</mui:ModernTab>
</Border>
</mui:ModernWindow>
Error Message:
Please let me if anyone needs additional information.
But, when I use "PriceSettingsView" in another project (calling from menu click event) PriceSettingView window is showing up but link "General" giving error message as "Navigation Failed. Cannot locate resource".
You provide a URI for GeneralSettings that is relative to the current project. In the original project A, the Views folder exists and contains the GeneralSettings view, but when you use PriceSettingsView in another project B, there neither the folder nor the view are present and therefore the view cannot be resolved.
You have to specify the URI to GeneralSettings relative to the assembly that contains it and reference the corresponding project. Specify the referenced assembly in the URI, for example:
<mui:Link DisplayName="General" Source="/PriceSettingsUI;component/Views/GeneralSettings.xaml"/>

How to display (transparent) animated gif in a Visual Studio extension panel?

I am developing a Visual Studio extension in C# and I would like to display a (waiting) transparent animated gif inside a tool window panel.
I have googled a lot and I only could find very complex solutions involving special dedicated libraries or some equivalent source code to add to my project. For example, I could find this post: How do I get an animated gif to work in WPF?. But I cannot understand why it would require such complex solutions for such a basic feature as animated gifs.
Can't XAML support natively animated gifs?
On my side I tried the following in my XAML file:
<Image Source="pack://application:,,,/MyPlugin;component/Resources/busy.gif"
Width="16" Height="16"/>
The image loads (although not animated) while Visual Studio is in edition mode. However, the image NEVER shows in the experimental instance.
What did I miss?
For example, I could find this post: How do I get an animated gif to
work in WPF?. But I cannot understand why it would require such
complex solutions for such a basic feature as animated gifs.
There're some easy ways to display .gif in wpf. For me, I use WpfAnimatedGif to do this.Simply install the nuget package and add the corresponding xmlns then the gif can display in wpf or vs extension.
For WpfAnimatedGif:
1.Add xmlns:gif="http://wpfanimatedgif.codeplex.com" to the xx.xaml.
2.<Image gif:ImageBehavior.AnimatedSource="xxx/xxx.gif" />
Then the .gif can display in the vs extension.
The format in my project:
<UserControl x:Class="VSIXProject2.ToolWindow1Control"
...
xmlns:gif="http://wpfanimatedgif.codeplex.com"
xmlns:vsshell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
Background="{DynamicResource {x:Static vsshell:VsBrushes.WindowKey}}"
Foreground="{DynamicResource {x:Static vsshell:VsBrushes.WindowTextKey}}"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Name="MyToolWindow">
<Grid>
<StackPanel Orientation="Vertical">
...
<Image gif:ImageBehavior.AnimatedSource="pack://application:,,,/VSIXProject2;component/Resources/time.gif" Height="100" Width="200"/>
</StackPanel>
</Grid>
</UserControl>
Note: To display the image when debugging VS extensions, the source format should be pack://application:,,,/xxx;component/Resources/xxx.gif. It's the different behavior between normal wpf and ToolWindows in vsix. More details see this.

g.i.cs files missing, classes no longer contain a definition for InitializeComponent

I've been developing a UWP project in my spare time to get a hang of UWP, MVVM and Prism. The project was originally really classic, with no use of MVVM and Prism, and I've been working to get those 2 into the project. I've been relying on https://msdn.microsoft.com/en-us/library/gg405484(v=pandp.40).aspx, https://msdn.microsoft.com/en-us/library/gg405494(v=pandp.40).aspx and https://msdn.microsoft.com/en-us/library/ff921098(v=pandp.40).aspx to work my way through it.
Some background: I originally had a direct function call from my Mainpage.xaml to the MainPage.xaml.cs codebehind, but during the conversion to MVVM and a separate usercontrol, I removed that function call so I could later using Command Binding. After I removed that, I got an error that was somewhere in GameRouletteView.g.i.cs that was a remnant of this removed function call, where the g.i.cs file assumed it was still bound. I rebuilt my project and those g.i.cs files apparently got removed.
I added the following lines to my Usercontrol View so my ViewModel gets added:
xmlns:gameRoulette="using:GameRoulette.DesignViewModels"
xmlns:prism="using:Prism.Windows.Mvvm"
d:DataContext="{d:DesignInstance gameRoulette:GameRouletteDesignViewModel, IsDesignTimeCreatable=True}"
prism:ViewModelLocator.AutoWireViewModel="True"
Full Code:
<UserControl
x:Class="GameRoulette.Views.GameRouletteView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GameRoulette.Views"
xmlns:gameRoulette="using:GameRoulette.DesignViewModels"
xmlns:prism="using:Prism.Windows.Mvvm"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400"
d:DataContext="{d:DesignInstance gameRoulette:GameRouletteDesignViewModel, IsDesignTimeCreatable=True}"
prism:ViewModelLocator.AutoWireViewModel="True">
<Grid Background="White">
<Button x:Name="btnSelectGames" Content="Click here to select your games"
HorizontalAlignment="Left" Margin="110,50,0,0"
VerticalAlignment="Top" Height="40" Width="240"
Click="{Binding SelectCommand}"/>
<Button x:Name="btnChooseGame" Content=""
HorizontalAlignment="Left" Margin="110,150,0,0"
VerticalAlignment="Top" Width="240" Height="40"
Click="{Binding ChooseCommand}" IsEnabled="True"/>
<ProgressRing HorizontalAlignment="Left" Margin="200,100,0,0"
VerticalAlignment="Top" RenderTransformOrigin="1.05,1.983"
Height="45" Width="45" IsActive="True" Visibility="{Binding }"/>
<Image x:Name="imgFileIcon" HorizontalAlignment="Left"
Height="64" Margin="110,224,0,0"
VerticalAlignment="Top" Width="64" />
<TextBlock x:Name="lblFileName" HorizontalAlignment="Left"
Margin="179,224,0,0" TextWrapping="Wrap"
Text="" VerticalAlignment="Top" Width="171" Height="64"/>
</Grid>
</UserControl>
It gave the following error:
The name "GameRouletteDesignViewModel" does not exist in the namespace "using:GameRoulette.DesignViewModels".
I rebuilt the project, and then it gave the following error for each of my 3 .xaml files: GameRouletteView, App.xaml andMainPage.xaml:
'GameRouletteView' does not contain a definition for 'InitializeComponent' and no extension method 'InitializeComponent' accepting a first argument of type 'GameRouletteView' could be found (are you missing a using directive or an assembly reference?)
Also, when first opening the project, I get the Intellisense errors:
[Failure] Could not find file 'C:\Users\username\Source\Repos\GameRoulette\GameRoulette\GameRoulette\obj\ARM\Debug\MainPage.g.i.cs'.
[Failure] Could not find file 'C:\Users\username\Source\Repos\GameRoulette\GameRoulette\GameRoulette\obj\ARM\Debug\Views\GameRouletteView.g.i.cs'.
[Failure] Could not find file 'C:\Users\username\Source\Repos\GameRoulette\GameRoulette\GameRoulette\obj\ARM\Debug\App.g.i.cs'.
Things I've ruled out:
My namespaces are correct;
I've tried https://stackoverflow.com/a/27260580/1770430, didn't work;
i've deleted the bin, obj folders and the .suo file, didn't fix it;
I've closed and reopened the solution, did not fix it.
Repair Visual Studio through the add/repair/remove programs window, no result.
I've googled this error, but I can't really find anything that I haven't tried yet.
I've also noticed that my NuGet Packages have gone missing and that my Package Manager Console does not recognize NuGet anymore. I also get this error:
Microsoft.NETCore.Portable.Compatibility 1.0.0 provides a compile-time reference assembly for mscorlib on UAP,Version=v10.0, but there is no run-time assembly compatible with win10.
I got a feeling that all these issues are related, but I can't figure out what's wrong with it. As mentioned above, Google doesn't really provide much assistance, and what it does provide doesn't work.
I'm using Visual Studio 2015 Community Edition with Update 1. The project can be found at https://github.com/nzall/GameRoulette.
I've struggled with this issue for a couple of days, and, at least in my case, I'm pretty sure that it depended on some subtle bug that I introduced inadvertently in my xaml code. Or, better, not exactly a bug, but something that's not supported by the version of xaml for the platform we are targeting. In that case the xaml parser fails, and the g.i.cs files (which contain the part of the pages and app classes generated by the parser, including the InitializeComponent method) are not generated as expected.
Why do I believe that?
At first, I thought it was a problem with Visual Studio, so I cleared component cache, then deleted completely the folder C:\Users{myname}\AppData\Local\Microsoft\VisualStudio\14.0, then I disinstalled and then reinstalled VS from scratch. I still had the error.
When I tried to build the solution, in the error windows I Only saw a generic 'Object reference not set to an instance of an object', but if I examined build output window, I could see that the problem was in effect related to the xaml parser (precisely: Xaml Internal Error WMC9999).
There's not so much on the internet about this issue, a part for a few help request by people facing the same situation, but the only two pages I managed to found that do offer a solution both linked this problem to the use of (different) unsupported functionality in xaml (code that is syntactically correct but unsupported by the target platform): see here and here.
I finally managed to get rid of the errors simply by undoing the last changes with my source control repository. Unfortunately, I had made a lot of change in code, so I can't say which was the exact line of code that caused the problem in my case. But the takeaway of this story is that every evidence points to the fact that it was something related to my xaml code. So, even if, of course, one can't exclude that sometimes there could be a major, system-wide issue with the xaml parser, I would advise other people facing this problem first to quickly undo the last changes and see if the problem disappears.

'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.'

The exception in the title is thrown when I open a window in WPF, the strange thing is that this does not happen on my Windows 7 development machine nor does it happen when it is deployed on Windows 7.
I only get this error on Windows XP, and only the second time that I open the window.
Here is the code to open the window:
ReportParametersWindow win = null;
bool canOverWrite = _shownReports.Contains(rpt.FriendlyName);
if (!(canOverWrite))
win = new ReportParametersWindow(rpt.FriendlyName, rpt.ReportParameters, canOverWrite);
else
win = new ReportParametersWindow(rpt.FriendlyName, (container.ParametersWindow as ReportParametersWindow).Controls, canOverWrite);
win.ShowDialog();
And the XAML for the window:
<Window xmlns:my="clr-namespace:MHA.Modules.Core.Controls;assembly=MHA.Modules.Core"
x:Class="MHA.Modules.Reports.Views.ReportParametersWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Parameters" Height="500" Width="600" MinWidth="500" MaxHeight="500"
Icon="/MHA.Modules.Reports;component/Images/Parameters.ico" SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterScreen"
xmlns:odc="clr-namespace:Odyssey.Controls;assembly=Odyssey" Closed="Window_Closed">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="0" Name="ScrollViewer1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" CanContentScroll="True">
<StackPanel Name="ParameterStack">
<my:LocationCtl Text="Parameters for report - " Name="loc"/>
</StackPanel>
</ScrollViewer>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<CheckBox ToolTip="This will replace the first report of the same type that was shown." Name="chkOverwrite" Content="Overwrite old" VerticalAlignment="Center" Margin="5,0"></CheckBox>
<Button Grid.Column="2" HorizontalAlignment="Right" Margin="5,0" Height="30" Style="{StaticResource DionysusButton}" Width="100" IsDefault="True" Click="Button_Click">
<StackPanel Orientation="Horizontal">
<Image Source="/MHA.Modules.Reports;component/Images/Success.png"></Image>
<TextBlock Margin="5,0" Text="Accept" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Button>
</Grid>
</Grid>
Does anyone have suggestions?
The solution is quite a weird one but I have it figured out.
I realized that the error was occurring on the InitializeComponent() of the window, I then added a try catch to the constructor and showed the InnerException of the Exception.
The error that I received is "Image format not recognized".
I have no idea why this happens only on XP and the second time that the window is shown but by replacing my .ico with a .png the problem was resolved.
Hope this helps someone.
I just ran into this issue as well... I know this is old, but what I had to end up doing was set the images to Resource, and Copy Always... only by browsing my /bin/Debug folder did I realize that the images were not at a valid path location
This problem can also occur if the required image is not available at the specified location. So Check the inner exception and add any image that might have been missed or misspelled.
I got this error because my Command Binding of a Button was wrong:
<Button Command="MyCommand" />
instead of
<Button Command="{Binding MyCommand}" />
You Should first Import Image to your project
Solution Explorer - Show All
then Right Click on the image and select Include
Now Use
end
In my case the root cause was wrong BuildAction property on all images. I fixed it by changing BuildAction from Content to Resource.
I got this exception after moving my Resource Dictionary from root of my application to a subdirectory. In my case the problem were Image paths inside my Style setters inside the dictionary. After I preceded them with a forward slash '/', the application started to work again. If you're having a similar problem, open the resource dictionary, and the error will be highlighted with the blue 'squiggly' line.
In my case, I have added 'WpfToolkit' refrence to my module, and there is no need.
After deleting this reference, everything was ok. Strange!
Just go to Project>[Your Project Name] Settings and set your .ico file as icon now your .ico file is mentioned in your manifest file and you can simply include your .ico file in your XAML file using
Icon="[icon file name].ico"
<Window x:Class="[Your project's name].MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="" Height="500" Width="720"
Icon="[your icon's name].ico">
In my case, I found the mew added icon(image) file is not added into my project. It is resolved after I added these new image files into my project, not just file copy.
In my case the files existed on disk but were not referenced in the project. I added them to the project but the error persisted despite reloading the solution and restarting Visual Studio.
I changed the references to an existing file that was already in the project and it ran fine (albeit with the wrong graphic). I then changed it back to the original reference and it ran fine again but with the correct image. Presumably the error was getting cached somehow until it was flushed out of the system...
Remove the "WPFToolkit" reference from your cs.proj file.
<Reference Include="WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
It should do the trick.
copy and paste the file name is changed. that's why I get this error.
well, in my case I added the new photos to the image Folder in FileExplore while image folder was added to the project while ago. and there wasn't any problem with the image path in the project. but when I build the project I face to the same error.
then I add those new photos to project by right click on the image folder and add the existing item and selected new photos. then I cleaned the solution and build it again.
There are many ways to cause this issue. Since the exception isn't specific. Here is a list of solutions to try from this thread.
Firstly, you can try/catch the InitializeComponent() call which is throwing the exception to get more details about what happened.
If the image is an icon (.ico) file use an image (.png) or equivalent instead
In some cases .ico files are problematic - I was using .NETCore
Make sure your image file has a build action of Resource or Embedded Resource
The resource files described in this section are different than the
resource files described in XAML Resources and different than the embedded
or linked resources described in Manage Application Resources (.NET). - MSDN
Ensure your reference to the file is spelled and pathed correctly
Example: "/Resources/logo.png" if you have a folder at the project level
Notice the prefix /.
Colors codes in the xaml file missing the hashtag prefix "#000FE0"
In my case, another program was using the image and somehow was blocking the access.
I mad a copy and this worked.
<Window
.....
Height="450" Width="400"
Icon="../Resources/SettingsCopy.png" >
To improve upon user2125523:
If you've added the image to the project and checked and double checked that the file spelling is correct, try renaming the image to mirror a different existing image. Build/run, then put your image file name back and build/run again.
For example:
My original code kept throwing the OP error on LargeImage="/img/32/delete.order.png" even though this file exists.
<telerik:RadRibbonButton Text="Object Properties" Size="Large"
Name="PropertiesButton" IsTabStop="True"
telerik:ScreenTip.Description="Get object properties"
Click="PropertiesButton_Click"
LargeImage="/img/32/properties.png"
SmallImage="/img/16/properties.png" />
<telerik:RadRibbonButton Text="Reset Tab Order" Size="Large"
Name="ClearTabOrderButton" IsTabStop="True"
telerik:ScreenTip.Description="Reset tab order of all fields"
Click="ClearTabOrder_Click"
LargeImage="/img/32/delete.order.png"
SmallImage="/img/16/delete.order.png" />
So, I changed LargeImage="/img/32/delete.order.png" to LargeImage="/img/32/properties.png", ran the program, and changed it back to "/img/32/delete.order.png". Finally the error was gone.
FYI VS2012.3 Win8.1Preview
I had the same issue and to add an image to you solution you have to do it through the wizzard. In the solution explorer -> right click on the appropriate folder-> add existing Item -> and then browse to your image. That worked for me. Hope this helps.
Thanks for you answers.
Try to set Build Action of Property of Image file as Resource.
Exception used to occur within constructor. Button's command binding was incorrect.
Eg: <Button Command="MyCommand" />--> Wrong
<Button Command="{Binding MyCommand}" />--> Right
In my case, I got this error when I had
<Border Background="eeeeee">
instead of
<Border Background="#eeeeee">
(notice the missign #)
I found "UpdateSourceTrigger=Pr" somewhere in my XAML.
Must have happened during editing.
Compiling went OK, no error then whatsoever.
Setting a BreakPoint in Application_DispatcherUnhandledException in app.xaml.cs revealed the error.
Corrected to "UpdateSourceTrigger=PropertyChanged" and the world was at it should have been.
I work on Win 10 Pro, VS2017
I encountered this error and figured out that the Image Source path format has a mistake. a forward slash / was added as follows:
Source="/TestProject;component/Images//hat_and_book.png
I removed that extra slash and the error had gone.
I got the same error message, then I find this solution :
Image not displaying at runtime C# WPF
Find your folder:Go to properties of the added image, set Build Action =>as Resource and Copy To Output Directory =>as Copy if newer.
In My case I have wrote a border tag with height property then i had to remove the value leaving the property like this
<Border Background="{StaticResource MainBackgroundBrush}" BorderThickness="1" Height="">
</Border>
The Compiler gave me the same error but the IDE have no problem so after some hard search i have found it. so make sure every property is properly set. I hope this would be useful for anyone.
it is caused by Non-standard tag option in xaml to find it set
InitializeComponent();
Function in - try mode - like this
try {
InitializeComponent();
}
catch (Exception ex) {
MessageBox.Show(ex.Message.ToString());
}
now MessageBox(( show line number with incorrect setting in control .axml file.(it just show first incorrect line tag error after Corrected it then run app again and see next one)

Using ICSharpCode.AvalonEdit on .Net 3.5?

I'm trying to use the ICSharpCode.AvalonEdit.TextEditor control from the SharpDevelop 4.0 project in a WPF app that I'm building, but I can't seem to get it to work.
I checked out a copy of the source code from svn://svnmirror.sharpdevelop.net/sharpdevelop/trunk/SharpDevelop/src/Libraries/AvalonEdit at revision 4304. Then, I built the project using Visual Studio 2008 SP1, which succeeded without errors.
I then created a blank new WPF project, added the build DLL to the toolbox and dropped the TextEditor control onto the default empty window, like so:
<Window x:Class="AvalonEditTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
Title="Window1" Height="300" Width="300" >
<Grid x:Name="LayoutRoot">
<avalonedit:TextEditor Name="textEditor" />
</Grid>
</Window>
However, when I run the project, the form comes up completely blank. No caret, the mouse cursor stays the default pointer, and the window does not respond to keypresses.
Am I missing something, or is AvalonEdit just a little broken?
[EDIT: I'm starting to think it might be related to my specific setup. I'm running the 64-bit Windows 7 RC. Might that have something to do with it? I've tried building it for x86 only, made no difference.]
Are you sure your namespace declaration is correct?
You can try something like this:
<Window x:Class="Editor.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300"
xmlns:e="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit">
<Grid>
<e:TextEditor x:Name="Editor" WordWrap="True" Height="200">
</e:TextEditor>
</Grid>
</Window>
I was able to get it to work without any issues.
The AvalonEdit TextEditor is just a view for a TextDocument model.
The problem was that a new AvalonEdit instance didn't start connected to any model instance, so there wasn't anything to edit.
The reason the code from statictype worked was that he didn't use <avalonedit:TextEditor/>, but <avalonedit:TextEditor></avalonedit:TextEditor>. This will assign an empty string to the Text property, which caused the editor to implicitly create a new document.
But this isn't relevant with recent AvalonEdit versions anymore, the editor will now always create a new TextDocument.
This works for me with the latest build
<DockPanel LastChildFill="True">
<avalonedit:TextEditor
HorizontalAlignment="Stretch"
Name="textEditor1"
VerticalAlignment="Stretch" />
</DockPanel>

Categories

Resources