Ich bin mir sicher, dass ich hier etwas falsch mache, aber wenn ich die AutowireViewModel Eigenschaft in der in einem Modul definierten Ansicht anhänge, kann das Ansichtsmodell nicht automatisch verbunden werden. Ich sehe das Ansichtsmodell nicht instanziiert. Mein Beispielprojekt bei Github ist (siehe unten)AutowireViewModel funktioniert nicht in einem Prism-Modul
<UserControl x:Class="MainModule.ToolbarWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mvvm="clr-namespace:Microsoft.Practices.Prism.Mvvm;assembly=Microsoft.Practices.Prism.Mvvm.Desktop"
mvvm:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel>
<Label>Test</Label>
<Label Content="{Binding Name}"></Label>
</StackPanel>
https://github.com/rohits79/PrismAutoWire/tree/master/Prism%20App/MainModule
Bitte ignorieren, den fest verdrahteten Weg bei https://github.com/rohits79/PrismAutoWire/blob/master/Prism%20App/Prism%20App/Bootstrapper.cs#L34
Ist das Usercontrol in einem ItemTemplate eines Itemscontrol verwendet? – Clemens
Nein, bitte schauen Sie sich den Quellcode auf dem GitHub –