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

Expander Header

1 Answer 368 Views
Expander
This is a migrated thread and some comments may be shown as answers.
StevenDale
Top achievements
Rank 2
StevenDale asked on 27 May 2009, 08:32 PM

I am trying to place to buttons in the expander header but I want them to be aligned to the right side of the expander header. However, the contents of the header do not take up the entire size of the header, they only take up the minimum space necessary to draw the controls in the header.
Here is what I have:

 

 

 

 

<telerik:RadExpander>

 

 

 

 

<telerik:RadExpander.Header>

 

 

 

 

<Grid Margin="5">

 

 

 

 

<Grid.ColumnDefinitions>

 

 

 

 

<ColumnDefinition Width="5*"/>

 

 

 

 

<ColumnDefinition Width="5*"/>

 

 

 

 

</Grid.ColumnDefinitions>

 

 

 

 

<Button HorizontalAlignment="Left" Content="Click Me" />

 

 

 

 

<Button Grid.Column="1" HorizontalAlignment="Right" Content="Click Me" />

 

 

 

 

</Grid>

 

 

 

 

</telerik:RadExpander.Header>

 

 

 

 

<TextBlock Text="This is a test of the telerik expander control." />

 

 

 

 

</telerik:RadExpander>

 

 

 

 

So I get
\/ Click Me Click Me                                        
This is a test of the telerik expander control

And I want this
\/ Click Me                                         Click Me
This is a test of the telerik expander control


I can get it to work with the following hack but I was hoping this would not be necessary.

 

 

 

<Grid>

 

 

 

<TextBox Margin="30,0,0,0" Height="1" Name="_hiddenWidthControl" />

 

 

 

<telerik:RadExpander IsExpanded="True">

 

 

 

<telerik:RadExpander.Header>

 

 

 

<StackPanel Width="{Binding ElementName=_hiddenWidthControl, Path=ActualWidth}">

 

 

 

<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">

 

 

 

<Button HorizontalAlignment="Right" Content="Click Me" />

 

 

 

<Button Grid.Column="1" HorizontalAlignment="Right" Content="Click Me" />

 

 

 

</StackPanel>

 

 

 

</StackPanel>

 

 

 

</telerik:RadExpander.Header>

 

 

 

<TextBlock Text="This is a test of the telerik expander control." />

 

 

 

</telerik:RadExpander>

 

 

 

</Grid>

 

 

 

Thanks,

Billy Jacobs

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 29 May 2009, 02:26 PM
Hi Billy Jacobs,

Thank you for your feedback. You can see a sample at the attached file.
I hope this will help you. Please see the code below for the key changes:
<telerik:RadExpander IsExpanded="True">  
            <telerik:RadExpander.Header> 
                <Grid Width="{Binding ElementName=_hiddenWidthControl, Path=ActualWidth}">  
                    <Button HorizontalAlignment="left" Content="Click Me" /> 
                    <Button HorizontalAlignment="Right" Content="Click Me" /> 
                </Grid> 
            </telerik:RadExpander.Header> 
            <TextBlock Text="This is a test of the telerik expander control." /> 
        </telerik:RadExpander> 

Sincerely yours,
Dimitrina
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.
Tags
Expander
Asked by
StevenDale
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Share this question
or