7

I want to work with a DataGrid in Kaxaml. How do I reference the toolkit dll?

H.B.
  • 166,899
  • 29
  • 327
  • 400

4 Answers4

18
  1. Copy WPFToolkit.dll to "C:\Program Files\Kaxaml\"
    • Restart Kaxaml

Now you can use such namespace:

xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
alex2k8
  • 42,496
  • 57
  • 170
  • 221
10

Another option would be to make a junction and add a probing path to Kaxaml's config.

Make Junction to code

  • run elevated cmd
  • cd "c:\Program Files (x86)\Kaxaml"
  • mklink /J ProbeFolder "c:\path-to-your-code"

Modify Kaxaml.exe.config

  • run elevated notepad
  • open "C:\Program Files (x86)\Kaxaml\Kaxaml.exe.config"
  • add the following to the <configuration>:
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="ProbeFolder"/>
   </assemblyBinding>
</runtime>
  • save the file
  • restart kaxaml
Todd White
  • 7,870
  • 2
  • 35
  • 34
  • This is an awesome solution and worked perfectly for me. Thanks! PS: A caveat, we use dmake to build our WPF apps, and we can't use the clr-namespace way of including an assembly (we have to use something like http://company.com/controls). So, make sure you're using the more fragile method (clr-namespace) to get it to work. – JoeB Mar 22 '13 at 16:03
  • This is the best solution I found when working with 3rd party control libraries because it includes the entire directory with out duplicating the files. Thanks for posting Todd. – VipX1 Oct 28 '13 at 11:52
  • All this does for me is give me an immediate crash when I launch Kaxaml, even when the target of ProbeFolder is empty. It seems to have a problem parsing the config file. I double-checked to make sure that I followed the steps correctly. I'm using the latest version of Kaxaml. – allonym Nov 22 '13 at 08:59
1

When mapping custom classes and namespaces in XAML using the clr-namespace/assembly notation, you can't specify the path of the assembly containing the class but just the assembly's name (more details can be found on MSDN), since all referenced assemblies must be linked during the XAML compilation via the project file.

Kaxaml doesn't support the concept of a project since it doesn't do any compilation but rather dynamically parses and renders the XAML entered in the editor "on-the-fly" by using the System.Windows.Markup.XamlReader class.

This means that when using Kaxaml you can only reference classes contained in the assemblies that are part of the .NET Framework.

Enrico Campidoglio
  • 56,676
  • 12
  • 126
  • 154
  • 5
    This answer is partially wrong. You can reference other assemblies by importing the namespace and copying the assembly to Kaxaml's current directory. – Kilhoffer Nov 30 '10 at 22:32
0

Building on top of Todd White's solution (& this is future reference for myself too) your XAML in Kaxaml would reference a 3rd party library as follows:

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:dxlc="clr-namespace:DevExpress.Xpf.LayoutControl;assembly=DevExpress.Xpf.LayoutControl.v13.2"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <!-- Layout Control  Start -->
  <dxlc:LayoutControl Orientation="Horizontal">
  </dxlc:LayoutControl>
  <!-- Layout Control  End -->
</UserControl>
VipX1
  • 115
  • 2
  • 10