Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
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"
        Title="MainWindow" Height="350" Width="525">
        <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}" />
Updated 14-Jul-14 13:48pm
[no name] 14-Jul-14 16:12pm    
The error message means exactly what it says. Your program does not know what the StaticResource BasicTextStyle or BasicContentStyle is. Probably because you missed a step in whatever tutorial you are following.
ahadji_547 14-Jul-14 19:30pm    
ok thanks.. i realized this and i've already reread many times the instructions for any assembly or any excerpt that i didn't include, but honestly i can't find anything more specific which explains something like that in order to write correctly this part for the .xaml file. The book just gives a part of the .xaml file and the rest it gives up to me without any further information on how to do so.. as i 've already said i 've never programmed before in this form, to display information in the UI
[no name] 14-Jul-14 20:21pm    
Well I am not sure what it is that you expect from us. You are not going to find this by including a bunch of assemblies. A style is a user created (that's you) definition of the style of the control. Since you did not include it in your window XAML file, it's probably included (in the book) in a MergedDictionary what that is or where is it we could not possibly know without reading the book ourselves.
ahadji_547 18-Jul-14 10:47am    
ok.. i found on the web how to create a style, but the example of the book stills incomplete.. anyway thanks for your help..

1 solution

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[^]
Share this answer
ahadji_547 18-Jul-14 10:57am    
thank you very much for your solution.. the ResourceDictionary was empty but i learned how to create a style.. the link is very helpful and also i found another link
but there are some gaps in the instructions of the book and when i solved this one, then some other questions came up on how to create the whole application..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900