kinect应用程序 - .xaml文件出错 [英] kinect applications - error with .xaml file

查看:116
本文介绍了kinect应用程序 - .xaml文件出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi! i have to do a program with kinect for my senior project and i'm new in doing programs with visual studio.. i follow the instructions of the "Kinect for Windows SDK Programming Guide" but the explanation of the .xaml file in one of the example applications of the book is insufficient and i made errors like these :
"the resource "BasicContentStyle" could not be resolved" and "the resource "BasicTextStyle" could not be resolved". to be more specific that's the whole explanation of .xaml file of this application:




   "Designing the Info Box UI
   This application displays information using the System.Windows.Controls.TextBlock class inside a System.Windows.Controls.Grid class. That is, each cell on the grid contains a Textblock component. The following excerpt from the MainWindow.xaml file shows how this is accomplished in XAML:
         <TextBlock Text="Connection ID" Grid.Row="1" Grid.Column="0"
         Style="{StaticResource BasicTextStyle}" />
         <TextBlock Text="{Binding ConnectionID}" Grid.Row="1" Grid.Column="1"
         Style="{StaticResource BasicContentStyle}" />
   As we are going to display the information in text format, we will be splitting the window into a number of columns and rows, where each of the individual rows is responsible for showing information for one single sensor. As you can see in the preceding code, we have two TextBlock controls. One of them shows the label and another is bound to a property that shows the actual data.
   Similar to this, we have several TextBlock controls that display the data for different information types. Apart from the text controls, we have button controls to start and
stop the sensor."




I included this library "System.Windows.Controls" on the .c file and i 've already searched the web but all the similar issues were more complicated than my application(It's just an info box which show some informations about the kinect device). Could anyone help me out with this? 
thanks in advance




<Window x:Class="KinectInfoBox.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <TextBlock Text="Connection ID" Grid.Row="1" Grid.Column="0" 

                   Style="{StaticResource BasicTextStyle}" />
        <TextBlock Text="{Binding ConnectionID}" Grid.Row="1" Grid.Column="1" 

                   Style="{StaticResource BasicContentStyle}" />
    </Grid>
</Window>

推荐答案

这里我假设您不知道xaml中是如何整合基本样式的。因此,首先要寻找(我的意思是在整个解决方案中搜索并确定样式的确切位置)BasicTextStyle和BasicContentStyle中的两个样式,并查看其确切位置。它应该位于其他xaml中的某个位置(这是您的ResourceDictionary)现在去了到app.xaml文件并看到它存在于ResourceDictionaries部分中。如果不存在,则在资源字典中添加此特定文件,然后再次尝试重新运行。





您也可以在其他地方执行此操作在如下所述的相同xaml上添加资源字典引用



在WPF中使用资源字典 [ ^ ]
Here I assumed that you dont know how exactly basic style is incorporated in xaml. So first of all look for(i mean search in whole solution and where exactly style is defined) two styles in BasicTextStyle and BasicContentStyle and see where exactly it is located.It should be somewhere in other xaml(which is your ResourceDictionary) and now go to app.xaml file and see that it is present in ResourceDictionaries section. If not present then add this particular file in Resource Dictionary and then try to Rerun again.


you can also do this in other by adding resource Dictionary Reference on the same xaml as described below

Using a Resource Dictionary in WPF[^]


这篇关于kinect应用程序 - .xaml文件出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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