RadExpander Content Issue

3 posts, 0 answers
  1. Max
    Max avatar
    13 posts
    Member since:
    Mar 2010

    Posted 24 Nov 2010 Link to this post

    I recently upgraded to the Q3 2010 RadControls for Silverlight and it seems as though the RadExpander control has changed.  My old code (which worked perfectly) looked like this:

    <telerik:RadExpander Visibility="Collapsed" x:Name="radExpander" Foreground="White" BorderThickness="0" ExpandDirection="Down" Header="" IsExpanded="True" HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="450" Margin="0,0,0,25"> <!-- Margin="0,0,15,10"-->
                <local:MyControl x:Name="MyControl" Background="#FF2B2B2B" BorderThickness="1" BorderBrush="#FF000000" Height="30" Margin="0,0,0,0">
                    <TextBlock FontSize="13" Height="25" Foreground="White" Text="" TextWrapping="Wrap" Padding="0" />
                </local:MyControl>
            </telerik:RadExpander>

    The new code (that is not working) looks like this:

    <telerik:RadExpander Visibility="Visible" x:Name="radExpander" Foreground="White" BorderThickness="0" ExpandDirection="Down" Header="" IsExpanded="True" HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="450" Margin="0,0,0,25">
        <telerik:RadExpander.Content>
            <local:MyControl x:Name="MyControl" Margin="0,0,0,0" Background="#FF2B2B2B" BorderThickness="1" BorderBrush="#FF000000" Height="30">
                        <TextBlock FontSize="13" Height="25" Foreground="White" Text="" TextWrapping="Wrap" Padding="0" />
            </local:MyControl>              
        </telerik:RadExpander.Content>          
    </telerik:RadExpander>

    The lines that contain my control (3, 4, 5) show the error: "Object reference not set to an instance of an object."  If I move "MyControl" outside of the RadExpander it works fine.

    What am I doing wrong, or am I no longer able to use the RadExpander control as I was before?
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 29 Nov 2010 Link to this post

    Hello Max,

    I prepared a sample project that uses your XAML code and I was unable to reproduce your exception. Could you please send me your project or an isolated sample that shows the issue? You can also modify my solution and send it back to me.

    Thank you for your cooperation in advance.

    Sincerely yours,
    Petar Mladenov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Max
    Max avatar
    13 posts
    Member since:
    Mar 2010

    Posted 29 Nov 2010 Link to this post

    Thanks, Peter.  As it turns out, my problem had something to do with the way templated controls are handled in Silverlight.  When I moved the XAML for "MyControl" from \Assets\Styles.xaml to \Themes\Generic.xaml, the expander began working again.

    Thanks,

    Max
Back to Top