Expander Header

2 posts, 0 answers
  1. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 27 May 2009 Link to this post

    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

  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 29 May 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top