小编Tra*_*aci的帖子

跨项目的部分类

是否可以跨项目进行部分课程.

例如,项目1有一个客户类.作为可选模块的Project2通过附加订单类并使用原始客户类来添加到客户类.

.net projects mvvm

9
推荐指数
1
解决办法
3455
查看次数

WPF unity尝试获取类型实例时发生激活错误

尝试使用Unity和Prism初始化模块时出现以下错误.该DLL被发现

return new DirectoryModuleCatalog() { ModulePath = @".\Modules" };
Run Code Online (Sandbox Code Playgroud)

找到dll并找到名称

  #region Constructors

    public AdminModule(
        IUnityContainer container,
        IScreenFactoryRegistry screenFactoryRegistry,
        IEventAggregator eventAggregator,
        IBusyService busyService
        )
        : base(container, screenFactoryRegistry)
    {
        this.EventAggregator = eventAggregator;
        this.BusyService = busyService;
    }

    #endregion

    #region Properties

    protected IEventAggregator EventAggregator { get; set; }
    protected IBusyService BusyService { get; set; }

    #endregion

    public override void Initialize()
    {
        base.Initialize();
    }

    #region Register Screen Factories

    protected override void RegisterScreenFactories()
    {
        this.ScreenFactoryRegistry.Register(ScreenKeyType.ApplicationAdmin, typeof(AdminScreenFactory));
    }

    #endregion

    #region Register Views and Various Services

    protected override …
Run Code Online (Sandbox Code Playgroud)

wpf modularity prism unity-container

8
推荐指数
1
解决办法
3万
查看次数

清除文本框不会将绑定设置为null

我在Nulllable DB Field上将空TextBox设置为null时遇到困难.

XAML

<y:TextBox Text="{Binding Year1Cost, Mode=TwoWay,  
     UpdateSourceTrigger=PropertyChanged,   
     NotifyOnValidationError=True,   
     ValidatesOnDataErrors=True,   
     ValidatesOnExceptions=True,  
     StringFormat=\{0:c\}}" Grid.Row="3" Grid.Column="1" />
Run Code Online (Sandbox Code Playgroud)

当我输入任何值时,绑定很好,输入的值被传递
当我单独留空值时传递null
如果我从TextBox中删除值,则传递的值是文本框的原始值,UI是没有通知变更Grrrrrrrrrrrrrrrr

我花了很长时间检查选项,只是把代码放在每个可空字段的OnTextChanged后面我无法看到这样做的效率.

提前致谢:

PS.看过TargetNullValue没有成功

Visual Studio 2008 - SP1 - .Net 3.5

data-binding wpf null textbox

6
推荐指数
2
解决办法
8177
查看次数

验证时的关键空值错误

我有一个数据网格,其中包含一个对象数组,一切正常,直到我向错误集合添加错误(IErrorInfo)

Property Changged发生以下错误

protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); <//---- here
            }
        }
Run Code Online (Sandbox Code Playgroud)

和DataGrid.UpdateLayout

    TimesheetArray = CreateMatrix(SelectedTimesheet.TimesheetDetails);
    RaisePropertyChanged("TimesheetArray");
    this.CrossTabDG.UpdateLayout();//----- HERE
    this.CrossTabDG.ItemsSource = this.TimesheetArray;
Run Code Online (Sandbox Code Playgroud)

错误代码

System.ArgumentNullException occurred
  Message=Key cannot be null.
Parameter name: key
  Source=System
  ParamName=key
  StackTrace:
       at System.Collections.Specialized.HybridDictionary.get_Item(Object key)
       at System.ComponentModel.PropertyChangedEventManager.PrivateAddListener(INotifyPropertyChanged source, IWeakEventListener listener, String propertyName)
       at System.ComponentModel.PropertyChangedEventManager.AddListener(INotifyPropertyChanged source, IWeakEventListener listener, String propertyName)
       at MS.Internal.Data.PropertyPathWorker.ReplaceItem(Int32 k, Object newO, Object parent)
       at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
       at MS.Internal.Data.ClrBindingWorker.AttachDataItem()
       at …
Run Code Online (Sandbox Code Playgroud)

.net c# wpf datagrid

2
推荐指数
1
解决办法
1539
查看次数

标签 统计

wpf ×3

.net ×2

c# ×1

data-binding ×1

datagrid ×1

modularity ×1

mvvm ×1

null ×1

prism ×1

projects ×1

textbox ×1

unity-container ×1