我有一个树视图和一个按钮.
当树视图中没有选择任何项目时,我想禁用按钮(IsEnabled = false)(我想在选择项目时启用按钮...).
我怎样才能做到这一点????
这是我的Xaml.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
x:Class="WpfApplicationTreeViewTest.MainWindow"
x:Name="Window"
Title="MainWindow"
Width="640" Height="480" WindowStartupLocation="CenterScreen" Margin="40" >
<StackPanel>
<TreeView x:Name="strategyTreeView" Margin="10 40 10 10">
<TreeViewItem Header="Test"></TreeViewItem>
<TreeViewItem Header="Test"></TreeViewItem>
<TreeViewItem Header="Test"></TreeViewItem>
<TreeViewItem Header="Test"></TreeViewItem>
</TreeView>
<Button Name="Panel" Content="Selected" Height="40" Width="100" Margin="10"/>
</StackPanel>
</Window>
Run Code Online (Sandbox Code Playgroud)
Thanxs!
我想在python中与我的串口通信.我为linux安装了pyserial和uspp:
import serial
ser = serial.Serial('/dev/pts/1', 19200, timeout=1)
print ser.portstr #check which port was really used
ser.write("hello") #write a string
ser.close() #
Run Code Online (Sandbox Code Playgroud)
它给出以下错误:
Traceback (most recent call last):
File "poi.py", line 5, in <module>
ser.open()
File "/usr/local/lib/python2.6/dist-packages/pyserial-2.5-py2.6.egg/serial/serialposix.py", line 276, in open
raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/tyUSB1: [Errno 2] No such file or directory: '/dev/tyUSB1'
Run Code Online (Sandbox Code Playgroud) 我不是很擅长linq2sql甚至是sql,但是所有东西都带有一点训练.
我的问题:我有3个表:项目,文件夹和任务.
我需要进行查询,以便我加入这3个表.
我试过了一下:
public ActionResult Details(string id) {
var user = GetProfile().Id;
var p = _db.Projects.Where(x => Convert.ToString(x.ProjectId) == id && x.UserId == user).SingleOrDefault();
var f = _db.Folders.Where(x => x.ProjectId == p.ProjectId).ToList();
return View(f);
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,我得到与项目相关的文件夹.现在我想在同一个查询中查找与文件夹和项目相关的任务.
所以最后我得到这个场景:单击项目名称,发送ID,获取ID,并显示与我单击的项目相关的文件夹,并在与文件夹相同的站点上显示任务.
是否可以使用REALbasic访问Macbook中的相机?我想让用户从相机中捕捉图像.
对于生成的字母表不是二进制的情况,是否容易推广霍夫曼编码树?例如,如果我想通过三元写出来压缩一些文本,我仍然可以为每个字符构建一个无前缀的编码系统.霍夫曼结构的直接推广(使用k-ary树而不是二叉树)是否仍能正常有效地工作?或者这种结构是否会导致编码方案效率极低?
我的代码:
function Check($Variable, $DefaultValue) {
if(isset($Variable) && $Variable != "" && $Variable != NULL) {
return $Variable;
}
else {
return $DefaultValue;
}
}
$a = Check(@$foo, false);
$b = Check(@$bar, "Hello");
//$a now equals false because $foo was not set.
//$b now equals "Hello" because $bar was not set.
Run Code Online (Sandbox Code Playgroud)
isset()测试一个变量时,引擎盖下的检查?编辑:
默认值是用户定义的.有时它会是一个数字,有时是一个字符串.
我正在使用TFS对象模型在命令行上做一些工作,我想重现在tf.exe和tfpt.exe中看到的工作空间检测行为,而不会因为我自己的特定实现而引入工件.目前,我的脚本需要的信息比tf.exe需要的更多 - 我的大量参数只是为了实例化连接.
具体来说,我必须要求用户显式传入服务器Uri(tfsUriString)和集合名称(tfsCollectionName),但这似乎是不必要和烦人的,因为tf.exe能够做到这一点.
Uri tfsUri = new Uri(tfsUriString);
TfsConfigurationServer configurationServer = TfsConfigurationServerFactory.GetConfigurationServer(tfsUri);
ReadOnlyCollection<CatalogNode> collectionNodes = configurationServer.CatalogNode.QueryChildren( new[] { CatalogResourceTypes.ProjectCollection }, false, CatalogQueryOptions.None);
CatalogNode collectionNode = collectionNodes.Where(node => node.Resource.DisplayName == tfsCollectionName).SingleOrDefault();
Guid collectionId = new Guid(collectionNode.Resource.Properties["InstanceId"]);
TfsTeamProjectCollection teamProjectCollection = configurationServer.GetTeamProjectCollection(collectionId);
var vcServer = teamProjectCollection.GetService<VersionControlServer>();
Run Code Online (Sandbox Code Playgroud)
可以使用哪些类和方法以与tf.exe相同的方式执行此检测?
在我的.htaccess文件中,我有:
<Files ~ "\.(tpl|txt)$">
Order deny,allow
Deny from all
</Files>
Run Code Online (Sandbox Code Playgroud)
这会拒绝任何文本文件被读取,但Google搜索引擎会给我以下错误:
robots.txt Status
http://mysite/robots.txt
18 minutes ago 302 (Moved temporarily)
Run Code Online (Sandbox Code Playgroud)
如何修改.htaccess以允许Google阅读robots.txt,同时禁止其他人访问文本文件?
任何人都知道为什么这不起作用:
SELECT clients_id FROM clients WHERE 34 IN (clients_groups)
Run Code Online (Sandbox Code Playgroud)
我将客户端组ID存储在文本列'clients_groups'中为34,35,42等.当clients_groups中只有一个值时,该语句正常工作,否则返回'not found'.
我想知道我们是否可以突出显示已PDF使用的文本(颜色)itextsharp?
我看到了创建新PDF等示例,同时我们可以应用颜色.我正在寻找可以从PDF获取大量文本并应用颜色并保存的地方.
这是我想要完成的事情,阅读PDF文件,解析文本并根据业务规则突出显示文本.
任何第三方dll建议也有效,这是我正在寻找的第一步opensource iTextsharp library.
c# ×2
.htaccess ×1
.net ×1
algorithm ×1
asp.net ×1
camera ×1
command-line ×1
compression ×1
exists ×1
huffman-code ×1
itextsharp ×1
linq-to-sql ×1
linux ×1
macos ×1
mysql ×1
php ×1
pyserial ×1
python ×1
realbasic ×1
robots.txt ×1
sdk ×1
tfs ×1
tfs2010 ×1
treeview ×1
triggers ×1
variables ×1
workspace ×1
wpf ×1