我目前正在尝试绑定到wpf中集合中的某些项目.最好用一个例子来解释.
我的XAML如下:
<Canvas Name="TaskCanvas" Width="467.667" Height="414">
<Ellipse Name="myElipse" Fill="White" Stroke="Black" Width="126" Height="76"
Canvas.Left="{Binding Path=XPos}" Canvas.Top="{Binding Path=YPos}" />
</Canvas>
Run Code Online (Sandbox Code Playgroud)
现在你可以看到我只是绑定到属性作为椭圆的一个简单示例,将它定位在我的数据源的x和y轴上.
我在window_load事件中有c#代码将我的数据源绑定到我的椭圆,如下所示:
PosClass posclass = new PosClass();
List<PosClass> posClasses = new List<PosClass>();
posclass.YPos = 100;
posclass.XPos= 100;
posClasses.Add(posclass);
posclass.YPos = 0;
posclass.XPos = 0;
posClasses.Add(posclass);
TaskCanvas.DataContext = posClasses;
Run Code Online (Sandbox Code Playgroud)
现在我从我的收藏中对canvas cotainer进行了绑定.PosClass是一个简单的类,有两个属性是'XPos'和'YPos'.
当我运行的代码设置我的椭圆正确绑定到这是伟大的,但作为椭圆没有设置采取从集合默认情况下它的确切行占用的最后一排,所以我的椭圆设置为0,0位置的数据源.
我想要做的是设置椭圆以使用XAML中附加的集合中的第一个项目,或者如果我有更多的项目,请说出第10个项目.我想再次在XAML中这样做,所以目前我只是绑定到X和Y位置,是否有某种语法让我也可以指定要使用的集合中的哪一行?
我尝试使用的标签...什么都试过叫各的UIViewController内一个UINavigationController ...阅读每一篇文章编程做的UITabBarController ...但香港专业教育学院的教程100%发现使用在UITableViewControllers ...这里是应用程序代表:
//
// mluThunderCamAppDelegate.m
// mluThunderCam
//
// Created by Paulo Ferreira on 11/9/09.
// Copyright MobileLifeUtils.com 2009. All rights reserved.
//
#import "mluThunderCamAppDelegate.h"
@implementation mluThunderCamAppDelegate
@synthesize window, tbcMain;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after application launch
UINavigationController *ncLocal;
mluThunderCam *vcThunderCam = [[mluThunderCam alloc] init];
ncLocal = [[UINavigationController alloc] initWithRootViewController:vcThunderCam];
[ncLocal release];
mluThunderCamPreferences *vcThunderCamPreferences = [[mluThunderCamPreferences alloc] init];
ncLocal = [[UINavigationController alloc] initWithRootViewController:vcThunderCamPreferences];
[ncLocal release];
NSArray *aViewControllers = [[NSArray alloc] initWithObjects:vcThunderCam, vcThunderCamPreferences, nil]; …Run Code Online (Sandbox Code Playgroud) iphone objective-c uitabbarcontroller uinavigationcontroller
有谁知道PowerPoint中的VBA/VSTO编程的未来是什么?我一直在研究Office自动化项目,发现使用PowerPoint特别令人沮丧,因为它似乎比Excel或Word中的VBA支持低一级.
感觉MS正试图逐步淘汰PowerPoints中对VBA的支持,因为他们在2007版本中放弃了宏录制,而对象模型缺少一些关键功能支持.
在我们当前的Asp.net MVC应用程序中,我们有两个菜单系统,一个在顶部,一个在左侧.现在我们有一个部分视图来呈现菜单,但是这也是唯一能让每个ViewModel返回菜单项的方法吗?我们试图不使用ViewData字典.
我认为答案是肯定的,但我希望看到其他人的想法
尝试通过以下方式附加已附加到给定上下文的对象时,我收到以下错误context.AttachTo(...):
ObjectStateManager中已存在具有相同键的对象.ObjectStateManager无法使用相同的键跟踪多个对象.
有没有办法实现以下方面:
context.IsAttachedTo(...)
干杯!
编辑:
Jason概述的扩展方法很接近,但它对我的情况不起作用.
我正在尝试使用另一个问题的答案中概述的方法做一些工作:
如何使用Linq to Entities*从表中删除一行或多行而不先检索行?
我的代码看起来有点像这样:
var user = new User() { Id = 1 };
context.AttachTo("Users", user);
comment.User = user;
context.SaveChanges();
Run Code Online (Sandbox Code Playgroud)
这工作正常,除非我为该用户执行其他操作,我使用相同的方法并尝试附加虚拟User对象.这失败是因为我之前已经附加了这个虚拟用户对象.我该如何检查?
当我看到这段代码时,我对java String的理解出错了.我不确定这是怎么回事.谁能解释为什么会这样?
public class NewClass {
public static void main(String[] args) {
String str=null;
System.out.println(str+"Added");
}
}
Run Code Online (Sandbox Code Playgroud)
输出:nullAdded
我目前使用一个缓存清单(如描述在这里).这有效地使得在用户离线时运行应用程序所需的资源.
不幸的是,它运作得有点好.
加载缓存清单后,Firefox 3.5+将缓存缓存清单中显式引用的所有资源.但是,如果服务器上的文件已更新,并且用户尝试在线时强制刷新页面(包括缓存清单本身),Firefox将绝对拒绝提取任何内容.应用程序在缓存的最后一点保持完全冻结.问题:
我正在尝试编写一个小工具,将图片从Google App Engine上传到Picasa.获取图像有效,但是当我尝试上传它时,我得到错误" TypeError:stat()参数1必须是(没有NULL字节的编码字符串),而不是str "
该代码基本上如下所示:
def getfile(url):
result = urlfetch.fetch(url)
if result.status_code == 200:
return (result.content)
logging.error ("[-] Error fetching URL: %s" % url)
def uploadpicture(comment,pic):
album_url = '/data/feed/api/user/%s/album/%s' % (username, album)
fname = "image.jpg"
entry = gd_client.InsertPhotoSimple(album_url, fname, comment, pic, content_type='image/jpeg')
picurl = "http://brilliantleap.com/blog/frog.jpg"
pic = getfile(picurl)
comment = "Test"
uploadpicture(comment, pic)
Run Code Online (Sandbox Code Playgroud)
完整的Stacktrace是:
Traceback(最近一次调用最后一次):
在调用 handler.get(*groups)中输入文件"/ home/birt/stuff/google/appengine/ext/webapp/init .py",第507行
文件"/home/birt/stuff/app_picasaupload/main.py",第124行,获取uploadpicture(评论,pic)
在uploadpicture entry = gd_client.InsertPhotoSimple(album_url,fname,comment,pic,content_type ='image/jpeg')中输入文件"/home/birt/stuff/app_picasaupload/main.py",第104行
在InsertPhotoSimple content_type中输入文件"/home/birt/stuff/app_picasaupload/gdata/photos/service.py",第469行
在InsertPhoto中输入文件"/home/birt/stuff/app_picasaupload/gdata/photos/service.py",第398行os.path.exists(filename_or_handle):#这是一个文件名
文件"/usr/lib/python2.5/posixpath.py",第171行,存在st = os.stat(path)
文件"/home/birt/stuff/google/appengine/tools/dev_appserver.py",1109,在通话 如果不是FakeFile.IsFileAccessible(路径):
文件"/home/birt/stuff/google/appengine/tools/dev_appserver.py",第1018行,IsFileAccessible normcase = …