kemarofangs
Topic Author
Posts: 32
Joined: 13 Jun 2014, 21:30

How To Add Expression Blend XAML w/ Code Behind

22 Jul 2016, 00:51

I'm trying to integrate an expression blend xaml into unity with noesis and having trouble.
The conversion doesn't seem to work. What am I doing wrong?
Here's the specific error. "Ignoring unknown type 'Silver_Gauntlet'"

Unity version 4.7.1.1f1

XAML that uses other custom defined xaml.
<Canvas
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"
  xmlns:darren="clr-namespace:Darren">
  <Border x:Name="m_border_playerArms">
      <darren:Silver_Gauntlet />
  </Border>
Custom defined xaml
<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"
  xmlns:noesis="clr-namespace:NoesisGUIExtensions"
	x:Class="Darren.Gauntlets_Silver"
	Width="50" Height="20">
	<!-- STUFF -->
</UserControl>
Custom defined xaml code behind
using System;

namespace Darren
{
	[Noesis.Extended]
	[Noesis.UserControlSource("Assets/Darren/Graphics/Vector/Player/Clothing/Arms/Gauntlets_Silver.xaml")]
	public class Gauntlets_Silver : Noesis.UserControl
	{
		/// <summary>
		/// Initialization.
		/// </summary>
		public void OnPostInit()
		{
		}
	}
}
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: How To Add Expression Blend XAML w/ Code Behind

22 Jul 2016, 16:16

Hi,

If your user control class is named Gauntlets_Silver, then you have to write exactly that name in the XAML:
<Canvas
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"
  xmlns:darren="clr-namespace:Darren">
  <Border x:Name="m_border_playerArms">
      <darren:Gauntlets_Silver />
  </Border>
As a sidenote, I suggest to avoid using "_" in your class names. as noted in MSDN Class Naming Guidelines.
 
kemarofangs
Topic Author
Posts: 32
Joined: 13 Jun 2014, 21:30

Re: How To Add Expression Blend XAML w/ Code Behind

22 Jul 2016, 22:17

Thanks! I feel so dumb right now.

Who is online

Users browsing this forum: No registered users and 1 guest