This is a migrated thread and some comments may be shown as answers.

RadExpander Content Issue

2 Answers 99 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 24 Nov 2010, 03:40 PM
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 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 29 Nov 2010, 02:37 PM
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
0
Max
Top achievements
Rank 1
answered on 29 Nov 2010, 06:50 PM
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
Tags
Expander
Asked by
Max
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Max
Top achievements
Rank 1
Share this question
or