Dears all,

I am working on a project where we use Windsor (through the extension
of the Composite WPF Contrib).

Our xaml file looks like this:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/
xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
    xmlns:Presentation="clr-namespace:XXX.Modules.MyForm.Presentation"
    xmlns:WinForms="clr-namespace:XXX.Modules.Common.WinForms"
    xmlns:Converters="clr-namespace:XXX.Modules.Common.Converters"
>
    <Converters:BooleanEnumConverter x:Key="YYYConverter"/>
   [snipped other converters]
    <DataTemplate DataType="{x:Type
Presentation:MyFormPresentationModel}">
        [snipped template xaml]
    </DataTemplate>
</ResourceDictionary>

I wrote a couple of interceptors (inheriting from IInterceptor and
implementing Intercept), but when I try to use them resolving the
presentation model, the xaml DataTemplate resolves to a string (the
name of the generated proxy, something as
IMyFormPresentationModelProxy1de831fc74a341249b67...), not to the
instanced object (which stepping in in debug I can see it is
registered and then created and then also proxied correctly, as far as
I can understand). This is exactly the same behaviour we get if we try
to use the interface (i.e. setting the DataType to "{x:Type
Presentation:IMyFormPresentationModel}" we get a string as well
instead of the object).

Using the .Net reference source symbols (and/or deblector) I have been
trying to step in on the exact bit of code which is setting that
string instead of the correct proxied object or even the underlying
instanced object, but with no luck so far.

I do think the issue may be with the xaml engine being unable to match
the proxied type with the DataType of the DataTemplate, and I found
out the .Net framework may perform that using the TypeExtension/
MarkupExtension classes and possibly some implementation of the
IXamlTypeResolver interface. From a quick search, I found out nowadays
people is using those mostly to provide some support for generics in
xaml (see i.e. 
http://social.msdn.microsoft.com/forums/en-US/wpf/thread/435ee321-f10c-4828-903b-7f3d3317a08d/
or 
http://blogs.msdn.com/mikehillberg/archive/2006/10/06/LimitedGenericsSupportInXaml.aspx).

>From a purely theoretical point of view, I don't like much the idea to
have to modify the xaml files to be able to intercept them, so I am
not absolutely sure I have been missing something.

Before trying to spend some time on that (i.e. writing our own
TypeExtension), I would like to ask if there is someone here with
previous experience or also some insight on this kind of scenario.

Last but not least, although I don't guess this is a Windsor bug (or
at last I cannot yet see why it should be :)), we are using Castle
project assemblies built from the revision 5380 of the 19th October
2008 in the trunk.

Incidentally, is there any good reason to update to a more recent
revision? I saw various commits on the revision log (i.e. fixes 77, 80
and 81 for DynamicProxy, and a few for the IOC) that maybe change some
conditions on the descripted scenario.

Kind regards,

--
ale
http://ale.riolo.co.uk
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to