.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to add 3D object from xaml file to my viewport3D?

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :WPF
I have viewport3D and I want to add multiple 3d objects defined in xaml files to this Viewport3D, but by default 3d object deffined in .xaml file comes already with viewport3D and I can not add it to my Viewport3D How I can use those 3D objects from .xaml files in my Viewport3D? I tryed to read xaml with XamlReader cast it to viewport3D and then take vieport3D child elements and add to my viewport, but I get error "Specified Visual is already a child of another Visual or the root of a CompositionTarget." 

View Complete Post

More Related Resource Links

Build an Easy Maintenance Intranet Site: Using Office Docs, File System Object, and OLE Structured S


If you've ever needed to build an easy-to-maintain intranet site, here's a solution based on Microsoft Office documents. Many sites require constant updating of their HTML, but the use of Word documents can simplify the process. This article details the construction of a human resources site that exploits the File System Object (FSO), OLE Structured Storage, and ActiveX capabilities of Word documents. This allows the HR staff to copy their revised or newly created Word files to the site, dynamically generate a list of links to their files, and free IS from the constant recoding of HR updates into new HTML pages.

Josef Finsel

MSDN Magazine March 2000

File not found for SPSite object

Hi,  I created a webapplication to access spsite object,When i try to access the site,I getting file not fount exception.If use the same code in windows form i am able to access the spsite object.Can any one tell me why its not working in web applications.I am using VS2008 and Moss 2007 is on the same machine. Thanks, Sreemouni.

How to Read values from the XAML file at Runtime

Hi , I am creating a BuildDefinition from code and Loading the Build Process template. Now,I want to read and Validate the Build Process template parameter values.When I am debuggig,I could see that these are in Xaml format. Ex: I have some value "BuildType" as "Daily" in xaml file.I want to read these values and validate them I dont know what is the bestway to read the values.Can any one please let me know how can we do it. Thanks, Srikrishna              

How to replace a file with existing file in SPDocument libray for an SPItem through Object model...

Hello All, Step1: I have created an SPItem in document libray by choosing a file through object model. Step2: Now i want to replace the existing file of the same SPItem with new file. How can i achieve this using SP Object model. Thanks in advance...

Themes/Generic.xaml issue when file is Link from another project


I have two Project A and B that use a Themes project. In the Themes project, I defined a Generic.xaml file. If I run the program on the A project, it works.

But in the second project (B) I don't create the Generic.xaml file but link (add existing item -> add as link) it from the first project (A). When I run this one I got this error :

'/Theme;component/Themes/Generic.xaml' value cannot be assigned to property 'Source' of object 'System.Windows.ResourceDictionary'. Cannot locate resource 'themes/generic.xaml'.  Error at object 'System.Windows.ResourceDictionary' in markup file 'AssemblyProjectB;component/app.xaml' Line 9 Position 37.

If in the second project (B) I create the file instead of linking the generic.xaml created in the first project (A), it works.

Any idea ?


Load Silverlight XAML file into WPF application



I want to load the XAML file of a Silverlight application to set data bindings into WPF window. I am able to load when x:name=classname is removed. But I want to load when it is present. Please help me if there way to achieve this.


View previous version of a file in document library using Client Object Model




Using Server-side object model, it is pretty simple to get the previous file versions. Say I wanted to view a file in its initial version, all I’d need to do is :




When using Client object model, I couldn’t any analogous method/property which would let me fetch the previous version of file.

Can somebody point me to a sample or the property which would serve my purpose?

What to do with XAML file and cs?


I downloaded some xaml controls, they are like dials and gauges.  I have referenced the DLLs in my ASP.NET Web application.


I want to add the control to a .ascx web user control - can anyone tell me what I need do to?


Many Thanks 

How to get file versions metadata using the client object


Hi everyone

I am looking for a SharePoint  client object method to obtain the file version metadada. So far the  only one similar that I have found is listItem.FieldValues but there is none for the previous versions of the file. I will appreciate any help



retrieving data records from xml data file using xaml(WPF).


I have an XML data file, and I have designed a XAML file with data binding to the data fields found in the XML data file.

When I run the XAML application, the first XML data record is displayed in the correct fields on the panel.

Is it possible to design an application to retrieve multiple records (multiple instances of each data field) using XAML alone?  or are C# (or VB) "code-behind" event handlers necessary to retrieve(or add) beyond the first record?

How to dynamically add the Visual elments from external file( say CustomButton.xaml) into the custom


We have a requirement on custom control. The visual elements of the control template needs to be ldoded from the external xaml file(from the end user say CustomButton.xaml) based on the user request in order to support the Component UI customization. We ahve followed the layered grid approach as explained below.

We have the custom control which has control tempalte contains 2 grids. In which the first grid(default grid) has the default visual elements. the second grid is empty(The visual elements are loaded dynamically). The triggers and converters are added into control template based on the children of default grid visual element names.

Based on the user request the UI of the control template needs to be updated into the second grid from the external xaml file(c:\test.xaml) which has the necessary visual elements. These visual elements can have the same name which is already used in the default grid children.  For this we define a dependency property called IsCustomXAML. if this property set to true then we will do the necessary logic in the property change call back of IsCustomXAML. they are like below


1. load the visual elements from external xaml file(c:\test.xaml) into the second grid.     

 UIElement externalXAMLElement = (UIElement)XamlReader.Load(new XmlTextReader(control.XamlPath));

Referencing image file stored in project resources through XAML



I'm sure this is super simple but I can't seem to figure this out.  Here is my scenario:

I have a bunch of .jpg image files that are included in a resources folder inside my project.  I want to reference them in XAML as follows:

<Image Name="SobeysImage" Stretch="Fill" ToolTip="Sobeys Image" FlowDirection="LeftToRight" Grid.Column="1" Source="Resources/sobeys1.jpg">

I get the following error message when I try to run the application:

Error 2 The file Resources\Sobeys1.jpg is not part of the project or its 'Build Action' property is not set to 'Resource'. C:\_Development\PhotoTool\PhotoTool\Window1.xaml 10 117 PhotoTool


I made sure that I set the build action of the image to Resource.


What am I missing???

How to retrieve the original XAML file name from code



I would like to display the original filename for the element the mouse is hovering over. Can I retrieve the original XAML-FileName from a FrameworkElement in code?

Paul Sinnema

Take a look at my blog: http://paul.sinnema.ch

XAML StaticReference to another file


How do I make a XAML BasedOn={StaticResource ...} reference to a Style in another file that is not in "this" object's hierarchy? I don't want to put all the shared resources in the App.xaml file.


File1 has something like the following:


<Page x:Class=”MyApp.MyPage”>



        <Style TargetType="TextBox" x:Key="MyStyleText">


Using the XML Source data flow object with one to many XML file


I am trying to use the SSIS XML Source object to insert data from an XML file into a relational database.  Within the file and database there are several one to many relationships.  For example, the Person table has a one to many relationship with the Phone table - one person can have multiple phone numbers. 

In my XML file, the PersonID is declared only once and that is with the person data.  I need the PersonID as a foreign key for the phone data.  The XML Source object displays multiple outputs for the XML file, including one each for Person and Phone.  However the Phone output does not include the PersonID which is required to insert the data into the Phone table. 

How can I get the PersonID to appear with the Phone data?  Is it a matter of modifying the XSD file, or is there method within SSIS where I can combine XML elements from different levels?


Problem streaming xaml file


So I am trying to stream the file "test.xaml" (on the root of my project) to a canvas. I have tried numerous methods and for some reason when I call it to stream the xaml document but it doesn't.

My Code:

System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("test.xaml");
StreamReader sr1 = new StreamReader(s); 
string xamlString = sr1.ReadToEnd(); 

canvas1 = XamlReader.Load(new System.IO.StreamReader(s).ReadToEnd().ToString()) as Canvas;


To debug, I made a textblock element called debug1 and I wanted to send my code stream as a string to the textblock (to see where my problem is).

Whats interesting is that after line 2 no code will be executed; I know this because the debug1 textblock isnt populated with any data (it remains with its default "textblock" text value). I do not get any errors back or anything.

I know how to put prewritten xaml on a canvas in a ton of ways. I just want to know why xaml file is not streaming at all (is the code right?) (is there something im forgetting?) (is there a better way of going about this?)

Quicknote: My xaml file is just a page xaml document, there's nothing special about it format wise. Also I have been searching a day now and I haven't found anyone with the same issue.

Using the Client Object Model to read values from Excel file produces 504 error



I use the Client Object Model to retrieve and read values from an Excel file. This is triggered in an Event Receiver on the Document Library where the Excel file lives. I use a simple CAML Query to retrieve the file. This has worked just fine on a dev/test server. 
Now, I just recently deployed this solution to a production/live server and now this code doesn't work anymore. I get an error saying 'The remote server returned an error: (504) Gateway Timeout'. This happnes when I try clientContext.ExecuteQuery();

The difference between the two servers is that on the test server (where it works) the solution is sitting as the root site, so to speak. No host headers or nothing.
On the live server, there are several web applications (SharePoint) on the same port, but with different host headers.

I have tried to trace a little bit and I found that on the test server, the url that is used to create the ClientContext object is 'http://<servername>/<webname>'. The url is comes from the following code: web.Url. I tried changing the url to the DNS name the test server has and that resulted in the same error as on the live server.

Does anyone have any idea what I need to do?

Thanks a billion!

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend