Ruby Forum IronRuby > Silverlight and Custom Components

Posted by Sean Clark Hess (Guest)
on 14.08.2008 21:09
(Received via mailing list)
Hi all,
One of the first things I tried to do when I started using IronRuby with
Silverlight was to separate my view components into separate components. 
I
soon learned, to my dismay, that it was way harder than it should be (as 
in
-- harder than flex does it).

The only way to do it is to use Application.current.load_component. I've
written a small component framework that does the job nicely (using
method_missing to proxy the loaded view ... it's pretty cool), but I 
want to
make sure there isn't a better way to do the same thing before I follow 
this
path any further.

Oh, and please let me know if this is the wrong mailing list for 
IronRuby
Silverilght development :)

If there isn't a RIGHT way to do this, I'm planning on posting the code 
on
my blog in a few days.

Thanks
~sean
Posted by Jimmy Schementi (Guest)
on 14.08.2008 21:54
(Received via mailing list)
Dividing things up into UserControls is the Silverlight model for 
separating UI components. You should be able to use those components 
from XAML by name, like <MyCustomUserControl />, as well as load them in 
Ruby using load_component. I suspect the first one doesn’t work, since 
it’ll require a real CLR type to be defined, and we need to figure out a 
way to fix that.

I’m going to start moving a good chunk of ironruby-silverlight code 
that’s currently part of silverline (http://schementi.com/silverline) 
into the ironruby-contrib project, so others can help me build a good 
client-side framework for ironruby-silverlight, which will ship on 
http://codeplex.com/sdlsdk.

That being said, I was going to revisit controls before SL2 ships, so 
I’d be interested in your solution, and whether or not something along 
those lines should ship in the SDK.

~Jimmy

On 8/14/08 12:03 PM, "Sean Clark Hess" <seanhess@gmail.com> wrote:

Hi all,

One of the first things I tried to do when I started using IronRuby with 
Silverlight was to separate my view components into separate components. 
I soon learned, to my dismay, that it was way harder than it should be 
(as in -- harder than flex does it).

The only way to do it is to use Application.current.load_component. I've 
written a small component framework that does the job nicely (using 
method_missing to proxy the loaded view ... it's pretty cool), but I 
want to make sure there isn't a better way to do the same thing before I 
follow this path any further.

Oh, and please let me know if this is the wrong mailing list for 
IronRuby Silverilght development :)

If there isn't a RIGHT way to do this, I'm planning on posting the code 
on my blog in a few days.

Thanks
~sean
Posted by Sean Clark Hess (Guest)
on 14.08.2008 22:29
(Received via mailing list)
You're right, the first one doesn't work. I tried every way I could 
think of
to declare custom xaml with nothing but the dlr, and it just doesn't 
work.
I'm guess there needs to be some other kind of namespace declaration -- 
one
that doesn't make the dlr look for an assembly. You say the dlr will 
support
this when Silverlight 2 ships?

My solution works, but it's impossible to declare user controls in xaml 
--
I've been declaring containers and then filling them in the
code-behind-esque's constructor.

I'll post that code sometime today for you to take a look at.  Thanks 
for
all the great help

On Thu, Aug 14, 2008 at 1:53 PM, Jimmy Schementi <
Posted by Sean Clark Hess (Guest)
on 14.08.2008 23:54
(Received via mailing list)
And here is the post.  Let me know what I should change, or if anything 
is a
waste of time. I'm new to both silverlight and ruby, so I'd love any
suggestions.
http://code.steelpotato.com/2008/08/mint-custom-user-controls-and-tools-for.html

I don't know who of you is involved in the dynamic silverlight SDK, but 
the
puts function is really screwed up. I included my fix for it as well. 
And
let's PLEASE get user controls into the Dynamic Silverlight 2 release

Thanks
~sean