我有一个集合,我需要3个不同的视图
1.所有收集数据
2.分组数据(分组标准将在应用程序生命周期中修改)
3.过滤数据(过滤条件将在应用程序生命周期中修改)
我想要的是所有视图都应该绑定到同一个集合,以便对集合的任何更改都应该同步到所有视图.
使用WPF,可以使用CollectionViewSource实现.
在Modern UI应用程序中,CollectionViewSource仍然存在,但功能有限.它没有SortDescription和FilterDescription.
如何在Modern UI应用程序中实现收集同步?
.net collectionviewsource microsoft-metro windows-runtime winrt-xaml
List<Person> PList = new List<Person>();
PList.Add(new Person{ Name = "Bob", email = "Bob.b@blah.org" });
Run Code Online (Sandbox Code Playgroud)
基本上,它保存文件中的重复行
我想弄清楚的是如何删除许多,直到列表中每个人只有一个实例.
我最初的想法是使用for循环来运行并基于比较删除
for (int i = 0; i < List.length; i++)
{
if (PList.position(i).name == PList.position(i++).name)
if (PList.position(i).date is < PList.position(i++).date)
"Then I will delete number 1"
}
Run Code Online (Sandbox Code Playgroud)
但是,我想知道是否有更好或更简单的方法来做到这一点?
我的目标是数据绑定与我的枚举相同的字符串.
public enum Language
{
Unknown=0,CSharp=1,VB=2,VisualCpp=3,FSharp=4
}
public enum ProjectType
{
Unknown=0,ConsoleApplication=1,ClassLibrary=2
}
Run Code Online (Sandbox Code Playgroud)
这是我的模型:
class PLanguage
{
public Language EnumLanguage { get; set; }
public string ImagePath { get; set; }
public List<ProjectType> EnumTypes { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
MyViewModel:
class PLanguageViewModel : ViewModelBase
{
public PLanguage PLanguage { get; set; }
private ObservableCollection<string> _typeCollection;
public PLanguageViewModel(PLanguage pLanguage)
{
PLanguage = pLanguage;
}
public ObservableCollection<string> TypeCollection
{
get{} //CAST PLanguage.EnumTypes FROM ENUM TO STRING
}
public string ImagePath
{
get …Run Code Online (Sandbox Code Playgroud) 我正在创建一个简单的城域应用.我也在创建同一个应用程序的非地铁版本.
我面临的问题是VS不允许我将普通类库引入metro应用程序,并将Metro类库引入普通应用程序.
Metro和非Metro应用程序之间的差异与UI以及一些不兼容的功能(例如,Metro中的FilePicker和非Metro中的OpenFileDialog)有关.
如何实现这一目标?
尝试运行WCF服务导致以下结果.我在http://msdn.microsoft.com/en-us/library/ms733768.aspx页面上尝试了与netsh相关的建议, 并且没有任何工作.请帮忙了解我如何解决这个问题.
提前致谢.
{"HTTP could not register URL http://+:8439/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."}
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at TestThreadSync.Form1.ListenOnChannel() in C:\Users\MyAccount\Desktop\TestService\Form1.cs:line 51
at TestThreadSync.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\MyAccount\Desktop\TestService\Form1.cs:line 32
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at …Run Code Online (Sandbox Code Playgroud) 如何使用Metro UI开发应用程序,以便它们可以在Windows XP/Vista/7上运行?
应用程序的一个示例是MetroBackUp.
我在Windows 7上安装了Visual Studio 2010和11 Beta.
是否必须在Windows 8 CP中开发它们?他们会在其他操作系统中工作吗
.net windows visual-studio-2010 microsoft-metro windows-runtime
我想写一个linq扩展(或自定义词典,排序列表或任何最佳解决方案),这将允许我为一个集合添加一个值,其键是"下一个可用".
例如:
int CreatedKey = IncrementDictionary.AddNext(myCustomer);
Run Code Online (Sandbox Code Playgroud)
如果当前存在的密钥如下:
1
2
8
4
3
Run Code Online (Sandbox Code Playgroud)
然后它会将myCustomer添加到字典中,键为5,它将返回该键.
你怎么看?
请原谅这个令人难以置信的愚蠢问题,但我不熟悉C#.我只是无法弄清楚如何在另一个项目中使用一个项目中的类.
假设我想从Project1中取一个字符串到Project2,并让Project2打印出字符串.
我使用"添加引用"菜单从Project1引用Project2,然后我添加"使用Project2"然后我将其写入尝试并从"Project2"中的"ClassA"调用"print".
Project2.ClassA Classa = new Project2.ClassA();
Console.WriteLine(Classa.print);
Run Code Online (Sandbox Code Playgroud)
但我得到的只是错误信息.
所以任何人都可以一步一步地解释为什么我需要做什么?
我有一个字符串,键是字符串.
一个项目有特殊的行为.对于相同的字符串,它不匹配.我想这与String.Equals行为有关.
甚至String.Equals返回错误的结果.(我知道字符串实习生的概念,但这似乎是不同的问题).
检查问题的图像(观察窗口).

我正在填充映射字典(来自xml资源文件)
var data = XDocument.Parse(str).Element(RootForXMLValidation).Elements().Where(x => x.Attribute("EcbFieldId") != null);
mappings = data.ToDictionary(x => x.Attribute("BoeField").Value.Trim(),
x => new Mapping { Key = x.Attribute("BoeField").Value.Trim(),
Type = (MappingType)Enum.Parse(typeof(MappingType),
x.Attribute("mappingType").Value), MappingDetail = x });
Run Code Online (Sandbox Code Playgroud)
为什么String.Equals会以这种方式运行?
假设我有一个类有两个string类型的属性
并且有以下限制
定义其值彼此依赖的属性的最佳方法是什么,以及在一个属性中进行的更改应该触发另一个属性的setter属性?
.net ×8
c# ×8
linq ×2
wpf ×2
.net-4.5 ×1
c#-4.0 ×1
collections ×1
compare ×1
data-binding ×1
dependencies ×1
enums ×1
equals ×1
exception ×1
list ×1
mvvm ×1
object ×1
properties ×1
string ×1
validation ×1
wcf ×1
windows ×1
windows-8 ×1
winforms ×1
winrt-xaml ×1