这不是秘密:Silverlight的DataGrid默认风格很漂亮而WPF很差.
让我向社区询问是否有人复制了SL样式以在WPF中使用,而不是重新发明轮子.
请查看截图并自行判断Silverlight和WPF团队如何投资他们的产品.
Silverlight默认样式的DataGrid:

WPF默认样式的DataGrid(在Saied K的回答之后更新):

伪示例:
<Window>
<Window.Tag>
<x:Dictionary KeyType="{x:Type sys:String}" ValueType="{x:Type sys:Int32}">
<sys:DictionaryEntry Entry="{sys:DictionaryEntry Key0, 000}"/>
<sys:DictionaryEntry Key="key1" Value="111"/>
<sys:DictionaryEntry>
<sys:DictionaryEntry.Key>
<sys:String>Key2<sys:String>
</sys:DictionaryEntry.Key>
<sys:DictionaryEntry.Value>
<sys:Int32>222</sys:Int32>
</sys:DictionaryEntry.Value>
</sys:DictionaryEntry>
</x:Dictionary />
</Window.Tag>
</Window>
Run Code Online (Sandbox Code Playgroud) 我的WinForms应用程序中有一个DataGridView和一个DataGridViewComboBoxColumn.我需要手动下拉(打开)这个DataGridViewComboBoxColumn,比如单击一个按钮后.
我需要这个的原因是我已将SelectionMode设置为FullRowSelect,我需要单击2-3次才能打开组合框.我想点击组合框,它应该立即下拉.我想用CellClick事件做这个,或者还有其他方法吗?
我在Google和VS帮助中搜索,但我还没有找到任何信息.
有人可以帮忙吗?
我试图将一个实体附加到ObjectContext.当我这样做时,抛出以下InvalidOperationException:
An object with the same key already exists in the ObjectStateManager.
The ObjectStateManager cannot track multiple objects with the same key.
Run Code Online (Sandbox Code Playgroud)
我检查了对象状态管理器,该项目不存在:
//Data context is actually the object context.
ObjectStateEntry contact;
while ( //Should only work once since it should be true if the item was attached
!DataContext.ObjectStateManager.
TryGetObjectStateEntry(Contact, out contact)
)
DataContext.Attach(Contact); //Here is the exception thrown.
Run Code Online (Sandbox Code Playgroud)
或者看看这个抽象的例子并告诉我它是否有意义:
EntityState state = Contact.EntityState; //Detached
DataContext.Attach(Contact); //Throws the exception.
DataContext.AttachTo("Entities.Contacts", Contact); //Throws the Exception
var detached = DataContext.ObjectStateManager.
GetObjectStateEntries(EntityState.Detached);
//InvalidArgumentException …Run Code Online (Sandbox Code Playgroud) 我想为VS2010开发一个扩展,这将允许我为语法突出显示一些额外的功能.
我安装了SDK,我该怎么做?
请给我一些小片段(或代码链接),我可以看到如何开始.
注意:我是否必须检查整个代码块,或者SDK告诉我每个单词是什么,如何声明等等?
我正在启动一个必须公开RESTful服务的项目,该服务将由多个操作系统的各种客户端使用.
我正在阅读使用Web API的Web API和OData,我很难决定使用什么,普通的Web API或OData.
有哪些显着的利弊?
更新
你们是否善良,并评论为什么这个问题"主要基于意见"?你在哪里看到任何个人意见?
我不能真正重现这个问题,但没有突出显示或intellisense在.js文件中工作,但它在文件中工作得很好.json.文件
的默认编辑器.js是JSON编辑器.
我尝试了安全模式,禁用所有扩展,重置所有设置,我甚至重新安装了IDE(修复),但问题仍然存在.
我将补充一点,当我启动IDE并且JS文件在作用域上打开时,我收到以下错误消息(突出显示和intellisense无论如何都不起作用):
"JavaScriptWebExtensionPackage"包未正确加载.
问题可能是由配置更改或安装另一个扩展引起的.您可以获取更多信息检查文件'C:\ Users\Shimmy\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'.
重新启动Visual Studio可以帮助解决此问题.
继续显示此错误消息?
在这里,您可以查看ActivityLog.xml文件,我粘贴在一些我认为可能相关的最近行中:
<entry>
<record>188</record>
<time>2015/08/14 13:00:57.332</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Begin package load [JavaScriptWebExtensionsPackage]</description>
<guid>{30DB8F9B-EC9F-44D6-B377-83C7C27A1A8B}</guid>
</entry>
<entry>
<record>189</record>
<time>2015/08/14 13:00:57.394</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [JavaScriptWebExtensionsPackage]</description>
<guid>{30DB8F9B-EC9F-44D6-B377-83C7C27A1A8B}</guid>
<hr>80131500</hr>
<errorinfo>Expected 1 export(s) with contract name "Microsoft.VisualStudio.JavaScript.Web.Extensions.ReferenceAutoSync.IReferencesFilePathProvider" but found 0 after applying applicable constraints.</errorinfo>
</entry>
<entry>
<record>190</record>
<time>2015/08/14 13:00:57.394</time>
<type>Error</type>
<source>VisualStudio</source>
<description>End package load [JavaScriptWebExtensionsPackage]</description>
<guid>{30DB8F9B-EC9F-44D6-B377-83C7C27A1A8B}</guid>
<hr>80131500</hr>
<errorinfo>Expected 1 export(s) with contract name "Microsoft.VisualStudio.JavaScript.Web.Extensions.ReferenceAutoSync.IReferencesFilePathProvider" but …Run Code Online (Sandbox Code Playgroud) javascript ide intellisense syntax-highlighting visual-studio-2015
我可以在SQL Server 2016中使用时态表.遗憾的是,Entity Framework 6还不知道这个功能.是否有可能使用实体框架6 使用新的查询选项(请参阅msdn)?
我创建了一个带有员工时态表的简单演示项目:
我使用edmx将表映射到实体(感谢Matt Ruwe):
使用纯sql语句一切正常:
using (var context = new TemporalEntities())
{
var employee = context.Employees.Single(e => e.EmployeeID == 2);
var query =
$@"SELECT * FROM [TemporalTest].[dbo].[{nameof(Employee)}]
FOR SYSTEM_TIME BETWEEN
'0001-01-01 00:00:00.00' AND '{employee.ValidTo:O}'
WHERE EmployeeID = 2";
var historyOfEmployee = context.Employees.SqlQuery(query).ToList();
}
Run Code Online (Sandbox Code Playgroud)
是否可以在没有纯SQL的情况下将历史记录功能添加到每个实体?我的解决方案作为实体扩展与反射来操纵SQL查询IQuerable并不完美.是否有现有的扩展或库来执行此操作?
编辑:(基于Pawel的评论)
我试图使用表值函数:
CREATE FUNCTION dbo.GetEmployeeHistory(
@EmployeeID int,
@startTime datetime2,
@endTime datetime2)
RETURNS TABLE
AS
RETURN
(
SELECT
EmployeeID,
[Name],
Position,
Department,
[Address], …Run Code Online (Sandbox Code Playgroud) 让我说我有这个截肢Person课:
class Person
{
public int Age { get; set; }
public string Country { get; set; }
public int SOReputation { get; set; }
public TimeSpan TimeSpentOnSO { get; set; }
...
}
Run Code Online (Sandbox Code Playgroud)
然后,我可以分组Age并Country喜欢这样:
var groups = aListOfPeople.GroupBy(x => new { x.Country, x.Age });
Run Code Online (Sandbox Code Playgroud)
然后我可以输出所有组的声誉总数如下:
foreach(var g in groups)
Console.WriteLine("{0}, {1}:{2}",
g.Key.Country,
g.Key.Age,
g.Sum(x => x.SOReputation));
Run Code Online (Sandbox Code Playgroud)
我的问题是,我怎样才能得到一笔TimeSpentOnSO房产?该Sum方法在这种情况下不起作用,因为它仅用于int此类.我以为我可以使用该Aggregate方法,但只是认真无法弄清楚如何使用它...我正在尝试各种组合的各种属性和类型,但编译器只是不会识别它.
foreach(var g in groups)
Console.WriteLine("{0}, {1}:{2}",
g.Key.Country,
g.Key.Age, …Run Code Online (Sandbox Code Playgroud) 我如何处理GetHashCode函数中的空字段?
Module Module1
Sub Main()
Dim c As New Contact
Dim hash = c.GetHashCode
End Sub
Public Class Contact : Implements IEquatable(Of Contact)
Public Name As String
Public Address As String
Public Overloads Function Equals(ByVal other As Contact) As Boolean _
Implements System.IEquatable(Of Contact).Equals
Return Name = other.Name AndAlso Address = other.Address
End Function
Public Overrides Function Equals(ByVal obj As Object) As Boolean
If ReferenceEquals(Me, obj) Then Return True
If TypeOf obj Is Contact Then
Return Equals(DirectCast(obj, Contact)) …Run Code Online (Sandbox Code Playgroud) c# ×2
.net ×1
aggregate ×1
asp.net ×1
concurrency ×1
datagrid ×1
datagridview ×1
dictionary ×1
equality ×1
gethashcode ×1
ide ×1
idictionary ×1
iequatable ×1
intellisense ×1
javascript ×1
key-value ×1
mef ×1
null ×1
odata ×1
rest ×1
silverlight ×1
sql ×1
styling ×1
temporal ×1
time ×1
vsix ×1
wpf ×1
wpftoolkit ×1
xaml ×1