今天看啥
热点:

accordion 定义了有一个item定义 accordionitem.header 中包含 radionbutton 为什么不可选,要切换到别的item后才可选,php自定义header


<layoutToolkit:Accordion Grid.Row="1" Grid.Column="0" Margin="0,0,5,0" Height="270"    >
            <layoutToolkit:AccordionItem  Tag="bbd"  Selected="AccordionItem_Selected" VerticalAlignment="Center"  Background="LightGray"  x:Name="fly_acc" IsSelected="False"  >
                <layoutToolkit:AccordionItem.Header >
                    <StackPanel Orientation="Horizontal" >
                        <TextBlock Text="三班排序"/>
                        <RadioButton Tag="bbd" Content="当日板块" IsChecked="true"  GroupName="r1" /><RadioButton Tag="bbd" Content="一班排序" GroupName="r1" /><RadioButton Tag="bbd" Content="二班排序" GroupName="r1" />
                    </StackPanel>
                </layoutToolkit:AccordionItem.Header>
     <layoutToolkit:AccordionItem.Content />
    </layoutToolkit:AccordionItem> 

解决方案


设计就是这样的,选中的AccordionItem会被Lock住,触发UpdateVisualState进而调用VSM来disable元素.如果你觉得这样设计不是很好欢迎到下面的地方提意见:
http://silverlight.codeplex.com/

private void SetLockedProperties()
{
    for (int i = 0; i < base.Items.Count; i++)
    {
        AccordionItem item = base.ItemContainerGenerator.ContainerFromIndex(i) as AccordionItem;
        if (item != null)
        {
            item.IsLocked = (item.IsSelected && this.IsMinimumOneSelected) && (this.SelectedIndices.Count == 1);
        }
    }
}

 public bool IsLocked
{
    get
    {
        return this._isLocked;
    }
    internal set
    {
        if (this._isLocked != value)
        {
            this._isLocked = value;
            this.UpdateVisualState(true);
        }
    }
}

internal virtual void UpdateVisualState(bool useTransitions)
{
    if (this.IsLocked)
    {
        VisualStates.GoToState(this, useTransitions, new string[] { "Locked" });
    }
...
}

<vsm:VisualStateGroup x:Name="LockedStates">
                  <vsm:VisualStateGroup.Transitions>
                      <vsm:VisualTransition GeneratedDuration="0" />
                  </vsm:VisualStateGroup.Transitions>
                  <vsm:VisualState x:Name="Locked">
                      <Storyboard>
                          <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="IsEnabled">
                              <DiscreteObjectKeyFrame KeyTime="0" Value="False" />
                          </ObjectAnimationUsingKeyFrames>
                      </Storyboard>
                  </vsm:VisualState>
                  <vsm:VisualState x:Name="Unlocked">
                      <Storyboard>
                          <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="IsEnabled">
                              <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                          </ObjectAnimationUsingKeyFrames>
                      </Storyboard>
                  </vsm:VisualState>
              </vsm:VisualStateGroup>

www.bkjia.comtrue/topics/20180111/38630.htmlTechArticleaccordion 定义了有一个item定义 accordionitem.header 中包含 radionbutton 为什么不可选,要切换到别的item后才可选,php自定义header layoutToolkit:Accordion Grid.Row=1 Grid.Column=0 Margin=0,0,5,0 Height=270   ...

相关文章

    暂无相关文章
相关搜索: webtechnolog

帮客评论

视觉看点