Windows Vista Forums

Loading a XAML File Containing Controls
  1. #1


    Bree Guest

    Loading a XAML File Containing Controls

    I have a XAML file that contains a few simple controls: stack panel,
    text boxes, labels, etc.

    I want to load this file into a separate XAML file (Window1.XAML) which
    contains a tab control.

    What are the steps involved? I tried defining the separate file as a
    resource, but that didn't work (most likely because I did it
    incorrectly).

    I have been through the Petzold book, and various WPF sites, but can't
    find an example of this.

    Any help would be very much appreciated.

    Thanks!




      My System SpecsSystem Spec

  2. #2


    Zhou Yong Guest

    Re: Loading a XAML File Containing Controls

    You can use Application.LoadComponent() to do the trick:
    System.Uri resourceLocater = new System.Uri("window1.xaml",
    System.UriKind.Relative);System.Windows.Application.LoadComponent(this,
    resourceLocater);Sheva



      My System SpecsSystem Spec

Loading a XAML File Containing Controls problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
WPF user controls without XAML Cairn Avalon 2 12 Apr 2007
Loading an XAML file into a DrawingVisual John Dunn Avalon 3 22 Jun 2006
File.xaml and File.xaml.cs are atomically checked out/in from sourcesafe Pascal Bourque Avalon 1 26 Apr 2006
XAML binding between controls? CosminB [BRT] Avalon 11 19 Apr 2006
How to make UI controls like button,TextBox 3d using XAML. Enigmatic Avalon 0 24 Feb 2006