4

I want to hide the toggle button in Expander as I am new to WPF.

Expander is inside a datagrid template.

here is the code

<DataTemplate >
  <StackPanel >

    <Expander  Margin="0,0,0,0"  Width="Auto" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed" PreviewGotKeyboardFocus="Expander_PreviewGotKeyboardFocus" >

      <Expander.Header>
        <Border x:Name="brdr_header" Padding="0" BorderThickness="0,0,0,1" BorderBrush="Black"   CornerRadius="0">

          <Grid x:Name="InnerData" Width="Auto" >
            <Grid.RowDefinitions>
              <RowDefinition  />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

3 Answers3

5

In the "Designer" view in visual studio you can

right click on the expander -> Edit Template -> Edit a Copy

Then choose were to put the style. And remove the toggle button and its triggers in the template. Done!

You can also restyle it if you want to,.

Tan
  • 2,148
  • 3
  • 33
  • 54
1

You could retemplate the control, or follow this example where you get the Templated Child of the control, and can manipulate it from there :)

Hope that helps :)

Community
  • 1
  • 1
Max Mazur
  • 1,188
  • 1
  • 13
  • 22
0

You can get the original style using Expression Blend (if you don't have a key use the trial version). If you got the style you can do anything you want to change the view; e.g. removing the toggle button.

Mighty Badaboom
  • 6,067
  • 5
  • 34
  • 51