Ich Bindung eines Entity Framework 6.0 Entity zu einem Caliburn Micro Ausblick:Bind Caliburn Micro EF Entity Fehler
<aura:AuditView Grid.Row="0" x:Name="SelectedAudit" cal:View.Model="{Binding SelectedAudit}" cal:View.Context="SelectedAudit"/>
Der Fehler auf dem Bildschirm erzeugt wird:
"Cannot find view for System.Data.Entity.DynamicProcies.Audit_9B5A..."
SelectedAudit
ist die Entitätseigenschaft im ViewModel. Soll ich eine Karte (AutoMapper) von + zu einer Entität zu einer neuen AuditModel
erstellen? Oder fehlt mir etwas Magisches?
EDIT: Code für aura:AuditView
<UserControl x:Class="Aura.AuditView"
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:aura="clr-namespace:Aura"
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<Style x:Key="LockedTextBox" TargetType="{x:Type TextBox}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="Background" Value="#FFEFE2E2"/>
</Style>
</UserControl.Resources>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Description" HorizontalAlignment="Right"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Description}" Margin="3" />
<Label Grid.Row="1" Grid.Column="0" Content="User" HorizontalAlignment="Right"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding UserId}" Margin="3" Style="{StaticResource LockedTextBox}"/>
<Label Grid.Row="0" Grid.Column="2" Content="Begin date" HorizontalAlignment="Right"/>
<DatePicker Grid.Row="0" Grid.Column="3" SelectedDate="{Binding BeginDate}" Margin="3"/>
<Label Grid.Row="1" Grid.Column="2" Content="Deadline" HorizontalAlignment="Right"/>
<DatePicker Grid.Row="1" Grid.Column="3" SelectedDate="{Binding Deadline}" Margin="3"/>
<Label Grid.Row="2" Grid.Column="2" Content="End date" HorizontalAlignment="Right"/>
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding EndDate, StringFormat=dd/MM/yyyy}" Margin="3" Style="{StaticResource LockedTextBox}"/>
</Grid>
</UserControl>
Es ist überhaupt nicht klar, was die Frage ist? Bitte versuchen Sie das Problem deutlicher zu formulieren. –
Nicht sicher, was passiert - erwarten Sie, dass die 'View.Context'-Bindung Ansichten aus dem" SelectedAudit "-Namespace aufnimmt? Wollten Sie 'View.Context' an eine Eigenschaft von' SelectedAudit' binden? Verwenden Sie eine Komposition, die die Ansicht für das ausgewählte Audit dynamisch auflösen soll? – Charleh
Hallo, ich versuche, SelectedAudit an shared zu binden: AuditView – grmbl