如何将.CS功能添加到Expression Design中构建的XAML类中? [英] How do I add .CS functionality to XAML classes built in Expression Design?

查看:48
本文介绍了如何将.CS功能添加到Expression Design中构建的XAML类中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将.CS功能添加到Expression Design中构建的XAML类中?


我有一个设计师向我提交的Silverlight项目似乎没有多少功能我已经注意到的第一件事情似乎是,似乎没有任何相应的.cs文件与看似
的内容匹配为"LayoutRoot"的子项。  我的意思是,正如它在Expression Blend中出现的那样,这些是"对象和时间线选项卡"中的子节点 在"LayoutRoot"下。


在Visual Studio 8中查看时,它们似乎是< Grid>儿童节点 
< 网格 < span style ="color:#ff0000; font-size:x-small">
x
< span style ="color:#0000ff; font-size:x-small"> 名称 =" LayoutRoot"
背景
=" Black"> Page.xaml类。
 第一步不应该生成一些.cs文件或类来处理这些网格的功能吗? 我搜索了第一个子网格的名称,但我没有在任何现有的.cs文件中获得任何结果。 
如何生成.cs文件?


Web Master和Programmer

解决方案

你是使用Expression Design或Expression Blend? 您将希望在Blend中使用.cs文件。在Blend中,查看"项目"面板以查找individual.xaml文件及其关联的.xaml.cs文件。


xaml的工作方式是编译项目时编译器生成一个隐藏的cs文件,该文件包含对xaml中对象的引用,这可以解释为什么在搜索中无法通过名称找到它们。


 


为usercontrol(称为代码隐藏文件)打开相应的.xaml.cs文件后,您应该能够使用x:Name属性中的值按名称访问xaml中的元素。 / p>

 


How do I add .CS functionality to XAML classes built in Expression Design?

I have a Silverlight project handed to me by designers that does not seem to have much functionalty to it yet.  One of the first things I have noticed is that there does not seem to be any corresponding .cs files that match up with what appears to be children of the "LayoutRoot".  I mean, as it appears in Expression Blend, these are child nodes in the "Objects and Timeline Tab" under "LayoutRoot".

When viewed in Visual Studio 8, they appear to be <Grid> children nodes of  <Grid x:Name="LayoutRoot" Background="Black"> of the Page.xaml class.  Shouldn't the first step be that I generate some .cs files or class to handle the functionality of these grids?  I did a search on the name of the first child grid and I did not get any results in any of the existing .cs files.  How do I generate .cs files?


Web Master and Programmer

解决方案

Are you using Expression Design or Expression Blend?  You will want to be working in Blend to work with .cs files. In Blend, look in the Project panel to find the individual.xaml files, and their associated .xaml.cs files.

The way xaml works is that when you compile your project, the compiler generates a hidden cs file that has the references to the objects from the xaml, which would explain why you can't find them by name in a search.

 

Once you have opened the appropriate .xaml.cs file for a usercontrol (called the code behind file) you should be able to access the elements in xaml by name using the value in the x:Name attribute.

 


这篇关于如何将.CS功能添加到Expression Design中构建的XAML类中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆