我有一个由VS 2015构建的WPF解决方案,由几个项目组成.突然,我开始在设计模式中收到一条警告,说明如下:
"窗口"类型不支持直接内容.
我理解一些控件如何不支持直接内容,但System.Windows.Window应该如此.UserControl对于通常支持直接内容的任何其他控件,我得到了相同的警告,据我所知.
一切都编译好并且运行良好,但是在我的所有XAML中都有蓝色下划线是令人烦恼的.还有其他人遇到过这个吗?
以下是截图:
好吧,我坚持认为应该是ExtJs中的基本任务.我正在编写一个简单的登录脚本,它将用户名和密码组合发送到RESTful Web服务,如果凭据正确,则会收到GUID.
我的问题是,我使用模型代理还是商店代理?
据我所知,Models表示单个记录,而Stores用于处理包含多个记录的数据集.如果这是正确的,那么看起来模型代理就是要走的路.
根据Sencha在http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Model上的文档,代码看起来像这样:
Ext.define('AuthenticationModel', {
extend: 'Ext.data.Model',
fields: ['username', 'password'],
proxy: {
type: 'rest',
url : '/authentication'
}
});
//get a reference to the authentication model class
var AuthenticationModel = Ext.ModelManager.getModel('AuthenticationModel');
Run Code Online (Sandbox Code Playgroud)
到目前为止一切正常,直到下一步:
//Use the configured RestProxy to make a GET request
AuthenticationModel.load('???', {
success: function(session) {
console.log('Login successful');
}
});
Run Code Online (Sandbox Code Playgroud)
Model类的load()方法是一个期望单个唯一标识符的静态调用.登录通常取决于两个因素,用户名和密码.
因此,似乎存储代理是在ExtJS中验证某人的用户名和密码凭证组合的唯一方法.有人可以验证和解释吗?任何帮助理解这一点将不胜感激.
我有一个WPF应用程序,我正在尝试实现MVVM.主窗口有一个viewmodel和一个自定义用户控件.此用户控件包含一个文本框和一个按钮,并从主父窗口共享datacontext.一切都很好...
我已经能够将文本框绑定到viewmodel中的变量,并且它可以成功运行.但是......对于我的生活,我无法将事件处理程序从按钮绑定到viewmodel.我一直收到以下错误:
Unable to cast object of type 'System.Reflection.RuntimeEventInfo' to type 'System.Reflection.MethodInfo'.
Run Code Online (Sandbox Code Playgroud)
我知道这是MVVM新手的常见问题.我在网上搜索过,似乎没什么用.谁能解释我做错了什么?
以下是一些示例代码:主窗口:
<Window x:Class="Mvvm.View.MainWindowView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:view="clr-namespace:ZeeZor.Kiosk.Mvvm.View"
WindowStyle="None"
WindowState="Maximized" >
<Grid >
<view:ControlPanelView
Margin="5, 0, 5, 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" >
</view:ControlPanelView>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
用户控件:
<UserControl x:Class="Mvvm.View.ControlPanelView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" TextAlignment="Right" Text="{Binding Total}" Margin="0,5,20,5" />
<Button Grid.Row="1" Content="Test" Click="{Binding Path=OnClick}" Width="220" Height="100"/>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud) 我正在使用ExtJS 4.2并使用分拣机创建了一个商店.商店从JSONP Web服务调用加载数据就好了,但它拒绝排序.下面是我的模型,存储和加载调用的表示.
模型:
Ext.define('Desktop.models.products.DtoProductFamilyModel', {
extend: 'Ext.data.Model',
fields: [
{
name: 'ProductFamilyId',
type: 'string',
useNull: false,
defaultValue: Util.getBlankGuid()
},
{
name: 'ParentProductFamilyId',
type: 'string',
useNull: true,
defaultValue: Util.getBlankGuid()
},
{
name: 'BaseItemId',
type: 'string',
useNull: true,
defaultValue: Util.getBlankGuid()
},
{
name: 'Name',
type: 'string',
useNull: false,
defaultValue: ''
},
{
name: 'DisplayName',
type: 'string',
useNull: false,
defaultValue: ''
},
{
name: 'ExternalReferenceId',
type: 'string',
useNull: true,
defaultValue: null
}
]
});
Run Code Online (Sandbox Code Playgroud)
商店:
Ext.define('Desktop.stores.products.GetProductFamiliesStore', {
extend: Ext.data.Store,
model: 'Desktop.models.products.DtoProductFamilyModel',
proxy: …Run Code Online (Sandbox Code Playgroud)