Search code examples
silverlight-toolkit

Button in Accordion Header is disabled (Silverlight toolkit 4.0)


I'm using the Silverlight toolkit 4.0 Accordion control

it appears buttons in header of selected accordion item are being disabled. I'm trying to rem the style "Locked" out then those buttons are enabled as expected but when I click on selected accordion item again, I get a runtime exeption like this

System.Windows.Controls.AccordionItem.OnIsSelectedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)

<vsm:VisualState x:Name="Locked">
    <Storyboard>
        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="IsEnabled">
            <DiscreteObjectKeyFrame KeyTime="0" Value="false"/>
        </ObjectAnimationUsingKeyFrames>
    </Storyboard>
</vsm:VisualState>

Could you please guide me how to fix that? I'd like to have buttons in header always enabled. Thanks khoailang


Solution

  • The button in header gets enabled with the following statement in code behind

    accordiocntl.SelectionMode = AccordionSelectionMode.ZeroOrOne;
    

    You can refer the link https://forums.silverlight.net/forums/p/134010/301229.aspx