Request for closer information about routed events

3 posts, 1 answers
  1. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 20 Apr 2009 Link to this post

    Hi,

    I hope you can give me some clarity about RoutedEvents (not about the thing at all - I know it from WPF) my question is about your Silverlight implementation.
    I first tried it with the help - but there is no chapter about routed events - I can only find the class documentation.

    I watched this session:
    http://blogs.telerik.com/NikolayAtanasov/Posts/09-02-05/New_Training_Session_on_Silverlight_Routed_Events.aspx

    And as I saw in the TOC there is a topic "set from XAML" I thought - wow - great.
    But by watching the sample I saw the at the "from XAML" part there was only a demonstration that I can consume this event defined on the button in XAML - that has nothing to do with RoutedEvents - it's just a proof that the implemented property is accessible from XAML.

    The code looks like this:

    <StackPanel Name="ButtonPanel" Grid.Column="0" Background="LightGray" Orientation="Horizontal" HorizontalAlignment="Center" > 
        <MyControls:MyButton Name="btnYes" Content="Yes" Height="50" Width="50" Margin="2" PreviewPressed="MyButton_PreviewPressed"></MyControls:MyButton> 
        <MyControls:MyButton Name="btnNo" Content="No" Height="50" Width="50" Margin="2"></MyControls:MyButton> 
        <MyControls:MyButton Name="btnCancel" Content="Cancel" Height="50" Width="50" Margin="2"></MyControls:MyButton> 
    </StackPanel> 
     
    So as you can see - the "routed event" is assigned on the button - but in this case it isn't what I want to have from a routed event.
    So I gave it a try (if it really works from XAML - in code behind it works I know) and changed the code like this:
    <StackPanel MyControls:MyButton.PreviewPressed="myPressed" Name="ButtonPanel" Grid.Column="0" Background="LightGray" Orientation="Horizontal" HorizontalAlignment="Center" > 
        <MyControls:MyButton Name="btnYes" Content="Yes" Height="50" Width="50" Margin="2" PreviewPressed="MyButton_PreviewPressed"></MyControls:MyButton> 
        <MyControls:MyButton Name="btnNo" Content="No" Height="50" Width="50" Margin="2"></MyControls:MyButton> 
        <MyControls:MyButton Name="btnCancel" Content="Cancel" Height="50" Width="50" Margin="2"></MyControls:MyButton> 
    </StackPanel> 
     
    So thats what I would do in WPF - or in other words what I would do to assign routed events in XAML.
    BUT - it does not compile. VS tells me that MyButton does not provide such an "appendable property".

    So am I doing something wrong or does this simply mean that your RoutedEvent implementation does not support XAML?

    Regards

    Manfred
  2. Answer
    Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 21 Apr 2009 Link to this post

    Hi Manfred,

    Unfortunately the Silverlight XAML parser does not allow us to add support for attaching event handlers in XAML and as far I can see, this is the biggest limitation of our routed events implementation.

    Kind regards,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 21 Apr 2009 Link to this post

    Tank you for this information.
    It doesn't make me happy (not your fault I know) - but it prevents me from searching.

    Regards

    Manfred
Back to Top