【发布时间】:2017-09-20 01:53:38
【问题描述】:
我有四个项目的解决方案,如:
- BridgeConcrete.BL
- BridgeConcrete.DAL
- BridgeConcrete.ViewModel
- BridgeConcrete.WPF
我正在使用:
- Microsoft.Practices.Prism.Mvvm 版本 1.1.1.0
- Microsoft.Practices.Prism.Mvvm.Desktop 版本 1.1.1.0
- Microsoft.Practices.Prism.SharedInterfaces 版本 1.1.1.0
BridgeConcrete.BL 还没有。
BridgeConcrete.DAL 有:
public class Project
{
public Project()
{
AddedBy = 1;
AddedDate = System.DateTime.Now;
}
public int Id { get; set; }
public string Name { get; set; }
public DateTime AddedDate { get; set; }
public int AddedBy { get; set; }
public DateTime? ModifiedDate { get; set; }
public int? ModifiedBy { get; set; }
// Calculated Fields
public int BridgeCount { get; private set; }
}
BridgeConcrete.ViewModel 有:
public class ProjectViewModel : BindableBase
{
private IEnumerable<Project> _projects;
public IEnumerable<Project> Projects
{
get { return _projects; }
set { SetProperty(ref _projects, value); }
}
private Project _selectedRecord;
public Project SelectedRecord
{
get { return _selectedRecord; }
set { SetProperty(ref _selectedRecord, value); }
}
public ProjectViewModel()
{
SelectedRecord = new Project() { Id = 1, Name = "Test 1" };
}
}
在 BridgeConcrete.WPF 中,我有:
1 .用户控件:ProjectView.xaml
<UserControl
x:Class="BridgeConcrete.WPF.ProjectView"
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:vm="clr-namespace:BridgeConcrete.ViewModel;assembly=BridgeConcrete.ViewModel"
mc:Ignorable="d"
d:DesignWidth="299.257" Height="140.059">
<UserControl.DataContext>
<vm:ProjectViewModel/>
</UserControl.DataContext>
<Grid >
<Label Content="Project ID:" HorizontalAlignment="Left" Margin="10,22,0,0" VerticalAlignment="Top"/>
<TextBox HorizontalAlignment="Left" Height="23" Margin="98,25,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="78" IsEnabled="False"
Text="{Binding SelectedRecord.Id }"/>
<Label Content="Project Name:" HorizontalAlignment="Left" Margin="10,48,0,0" VerticalAlignment="Top"/>
<TextBox HorizontalAlignment="Left" Height="23" Margin="99,53,0,0" TextWrapping="Wrap" Text="{Binding SelectedRecord.Name}" VerticalAlignment="Top" Width="145" />
</Grid>
</UserControl>
- MainWindow.xaml:
我将用户控件称为:
<local:ProjectView Margin="0,0,0.4,5.4"/>
错误是:
System.Windows.Markup.XamlParseException: '方法或操作未实现。'
内部异常
NotImplementedException:方法或操作未实现。
我做了很多搜索,但我找不到解决方案,除了我必须调试。所以,我这样做了,我发现问题出在 Prism 上。
当我移除 Prism 的继承时,它运行良好。
问题:
这是什么问题,请问如何解决这个问题
【问题讨论】:
-
您可能想尝试的第一件事是升级到最新版本的Prism。 6.3 现已推出。
-
我用的是最新版,你说的是旧版。
-
最新版本的 Prism 中不再使用 Microsoft.Practices.Prism 命名空间。您上面列出的程序集给我的印象是您使用的是旧版本。
标签: c# visual-studio mvvm prism