不一致的Silverlight 4 ComboBox下拉显示

Pau*_*aul 6 c# silverlight combobox silverlight-4.0

我有一个Silverlight 4应用程序,在表单底部附近有一个ComboBox.Dropdown中可以有大约30到100个项目.

当我第一次打开ComboBox时,没有SelectedItem,Dropdown向上打开,它可以看到大约23个条目; 只要我没有选择项目,每次重新打开Dropdown时它都会继续这种行为.一旦我选择了一个项目,每次我打开ComboBox后,它总是向下打开Dropdown,并且只显示3个条目.

我猜Dropdown仅限于3项,因为这是我在屏幕上最大化时窗口的下限.

即使先前已选择某个项目,如何让它显示更多项目?

下面是一个示例Silverlight应用程序,它演示了浏览器内外的行为.

MainPage.xaml中:

<UserControl x:Class="ComboBox_Test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="650" d:DesignWidth="1024">

    <Grid x:Name="LayoutRoot" Background="LightSteelBlue" Loaded="MainPage_OnLoaded">
        <Grid.RowDefinitions>
            <RowDefinition Height="3*" MinHeight="25" MaxHeight="25" />
            <RowDefinition Height="35*" MinHeight="200" />
            <RowDefinition Height="10*" MinHeight="70" MaxHeight="70" />
            <RowDefinition Height="30*" MinHeight="230" MaxHeight="230" />
            <RowDefinition Height="*" MinHeight="10" MaxHeight="30" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="12" />
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="12" />
        </Grid.ColumnDefinitions>
        <TextBlock Name="lblData" Text="Data:" Grid.Row="1" Grid.Column="1" />
        <TextBox x:Name="txtData" Grid.Row="1" Grid.Column="2" VerticalScrollBarVisibility="Auto"
                HorizontalScrollBarVisibility="Auto" />
        <StackPanel x:Name="AccessPanel" Orientation="Vertical" HorizontalAlignment="Left" Margin="5"
                Grid.Row="3" Grid.Column="2" Visibility="Visible">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="75" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <StackPanel x:Name="CreationPanel" Orientation="Vertical" Grid.Row="1">
                    <Grid x:Name="CreationRoot">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <StackPanel x:Name="TypesPanel" Orientation="Horizontal" Grid.Row="1" Grid.Column="1"
                                        Margin="0 5 0 5">
                            <Grid x:Name="TypesRoot">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25" />
                                    <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="220" />
                                    <ColumnDefinition Width="220" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="Types" FontFamily="Arial" FontSize="12" FontWeight="Bold"
                                                        Grid.Row="0" Grid.Column="0" />
                                <ComboBox x:Name="cboTypes" Width="220" Height="30" Grid.Row="1" Grid.Column="0"
                                                        IsEnabled="True"
                                                        SelectionChanged="cboTypes_SelectionChanged">
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Name, Mode=OneWay}" />
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>
                            </Grid>
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </Grid>
        </StackPanel>
    </Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)

MainPage.xaml.cs中:

using System;
using System.Windows;
using System.Windows.Controls;

namespace ComboBox_Test
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void UpdateDataText(DataTypeDesc oData)
        {
            txtData.Text = String.Format("{0}\n\t{1}", oData.Name, oData.Desc);
        }

        private void MainPage_OnLoaded(object sender, RoutedEventArgs e)
        {
            object[] aDataTypeDescs = new object[] 
            {
                  new DataTypeDesc() {Name = "Boolean", Desc = "A Boolean value"}
                , new DataTypeDesc() {Name = "Byte",    Desc = "An 8-bit unsigned integer"}
                , new DataTypeDesc() {Name = "Char",    Desc = "A Unicode character"}
                , new DataTypeDesc() {Name = "Double",  Desc = "A double-precision floating-point number"}
                , new DataTypeDesc() {Name = "float",   Desc = "A single-precision floating-point number"}
                , new DataTypeDesc() {Name = "Int16",   Desc = "A 16-bit signed integer"}
                , new DataTypeDesc() {Name = "Int32",   Desc = "A 32-bit signed integer"}
                , new DataTypeDesc() {Name = "Int64",   Desc = "A 64-bit signed integer"}
                , new DataTypeDesc() {Name = "SByte",   Desc = "An 8-bit signed integer"}
                , new DataTypeDesc() {Name = "UInt16",  Desc = "A 16-bit unsigned integer"}
                , new DataTypeDesc() {Name = "UInt32",  Desc = "A 32-bit unsigned integer"}
                , new DataTypeDesc() {Name = "UInt64",  Desc = "A 64-bit unsigned integer"}
                , new DataTypeDesc() {Name = "A",       Desc = "The letter A in the alphabet"}
                , new DataTypeDesc() {Name = "B",       Desc = "The letter B in the alphabet"}
                , new DataTypeDesc() {Name = "C",       Desc = "The letter C in the alphabet"}
                , new DataTypeDesc() {Name = "D",       Desc = "The letter D in the alphabet"}
                , new DataTypeDesc() {Name = "E",       Desc = "The letter E in the alphabet"}
                , new DataTypeDesc() {Name = "F",       Desc = "The letter F in the alphabet"}
                , new DataTypeDesc() {Name = "G",       Desc = "The letter G in the alphabet"}
                , new DataTypeDesc() {Name = "H",       Desc = "The letter H in the alphabet"}
                , new DataTypeDesc() {Name = "I",       Desc = "The letter I in the alphabet"}
                , new DataTypeDesc() {Name = "J",       Desc = "The letter J in the alphabet"}
                , new DataTypeDesc() {Name = "K",       Desc = "The letter K in the alphabet"}
                , new DataTypeDesc() {Name = "L",       Desc = "The letter L in the alphabet"}
                , new DataTypeDesc() {Name = "M",       Desc = "The letter M in the alphabet"}
                , new DataTypeDesc() {Name = "N",       Desc = "The letter N in the alphabet"}
                , new DataTypeDesc() {Name = "O",       Desc = "The letter O in the alphabet"}
                , new DataTypeDesc() {Name = "P",       Desc = "The letter P in the alphabet"}
                , new DataTypeDesc() {Name = "Q",       Desc = "The letter Q in the alphabet"}
                , new DataTypeDesc() {Name = "R",       Desc = "The letter R in the alphabet"}
                , new DataTypeDesc() {Name = "S",       Desc = "The letter S in the alphabet"}
                , new DataTypeDesc() {Name = "T",       Desc = "The letter T in the alphabet"}
                , new DataTypeDesc() {Name = "U",       Desc = "The letter U in the alphabet"}
                , new DataTypeDesc() {Name = "V",       Desc = "The letter V in the alphabet"}
                , new DataTypeDesc() {Name = "W",       Desc = "The letter W in the alphabet"}
                , new DataTypeDesc() {Name = "X",       Desc = "The letter X in the alphabet"}
                , new DataTypeDesc() {Name = "Y",       Desc = "The letter Y in the alphabet"}
                , new DataTypeDesc() {Name = "Z",       Desc = "The letter Z in the alphabet"}
            };

            cboTypes.ItemsSource = aDataTypeDescs;
        }

        private void cboTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataTypeDesc oDesc = (DataTypeDesc)(cboTypes.SelectedItem);
            if (oDesc != null)
                UpdateDataText(oDesc);
        }

    }
}
Run Code Online (Sandbox Code Playgroud)

DataTypeDesc.cs:

using System;

namespace ComboBox_Test
{
    public class DataTypeDesc
    {
        public String Name { get; set; }
        public String Desc { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

Gon*_*ing 3

您需要编辑基本的 ComboBox 模板并更改名为 Popup 的元素的大小。在此示例中,它已设置为 100 高,现在无论初始列表还是选择后都显示相同的固定高度弹出窗口:

在此输入图像描述

*注意:我使用 Expression Blend 来编辑基本模板的副本(非常详细)。由于元素部分被命名为“Popup”,理论上您可以编写代码来在可视化树中查找该部分并以这种方式修改高度属性。

更改后的页面来源如下:

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="ComboBox_Test.MainPage"
d:DesignHeight="650" d:DesignWidth="1024" mc:Ignorable="d">

    <UserControl.Resources>
        <ControlTemplate x:Key="ValidationToolTipTemplate">
            <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
                <Grid.RenderTransform>
                    <TranslateTransform x:Name="xform" X="-25"/>
                </Grid.RenderTransform>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="OpenStates">
                        <VisualStateGroup.Transitions>
                            <VisualTransition GeneratedDuration="0"/>
                            <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
                                <Storyboard>
                                    <DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
                                        <DoubleAnimation.EasingFunction>
                                            <BackEase Amplitude=".3" EasingMode="EaseOut"/>
                                        </DoubleAnimation.EasingFunction>
                                    </DoubleAnimation>
                                    <DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
                                </Storyboard>
                            </VisualTransition>
                        </VisualStateGroup.Transitions>
                        <VisualState x:Name="Closed">
                            <Storyboard>
                                <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Open">
                            <Storyboard>
                                <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform"/>
                                <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Border Background="#052A2E31" CornerRadius="5" Margin="4,4,-4,-4"/>
                <Border Background="#152A2E31" CornerRadius="4" Margin="3,3,-3,-3"/>
                <Border Background="#252A2E31" CornerRadius="3" Margin="2,2,-2,-2"/>
                <Border Background="#352A2E31" CornerRadius="2" Margin="1,1,-1,-1"/>
                <Border Background="#FFDC000C" CornerRadius="2"/>
                <Border CornerRadius="2">
                    <TextBlock Foreground="White" MaxWidth="250" Margin="8,4,8,4" TextWrapping="Wrap" Text="{Binding (Validation.Errors)[0].ErrorContent}" UseLayoutRounding="false"/>
                </Border>
            </Grid>
        </ControlTemplate>
        <Style x:Key="ComboBoxStyle1" TargetType="ComboBox">
            <Setter Property="Padding" Value="6,2,25,2"/>
            <Setter Property="Background" Value="#FF1F3B53"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="TabNavigation" Value="Once"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
                        <GradientStop Color="#FF8399A9" Offset="0.375"/>
                        <GradientStop Color="#FF718597" Offset="0.375"/>
                        <GradientStop Color="#FF617584" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ComboBox">
                        <Grid>
                            <Grid.Resources>
                                <Style x:Name="comboToggleStyle" TargetType="ToggleButton">
                                    <Setter Property="Foreground" Value="#FF333333"/>
                                    <Setter Property="Background" Value="#FF1F3B53"/>
                                    <Setter Property="BorderBrush">
                                        <Setter.Value>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFA3AEB9" Offset="0"/>
                                                <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                                <GradientStop Color="#FF718597" Offset="0.375"/>
                                                <GradientStop Color="#FF617584" Offset="1"/>
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="BorderThickness" Value="1"/>
                                    <Setter Property="Padding" Value="3"/>
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="ToggleButton">
                                                <Grid>
                                                    <VisualStateManager.VisualStateGroups>
                                                        <VisualStateGroup x:Name="CommonStates">
                                                            <VisualState x:Name="Normal"/>
                                                            <VisualState x:Name="MouseOver">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundOverlay"/>
                                                                    <ColorAnimation Duration="0" To="#7FFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                                                    <ColorAnimation Duration="0" To="#CCFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                                                    <ColorAnimation Duration="0" To="#F2FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Pressed">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackgroundOverlay2"/>
                                                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Highlight"/>
                                                                    <ColorAnimation Duration="0" To="#E5FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                                                    <ColorAnimation Duration="0" To="#BCFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                                                    <ColorAnimation Duration="0" To="#6BFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                                                    <ColorAnimation Duration="0" To="#F2FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Disabled"/>
                                                        </VisualStateGroup>
                                                        <VisualStateGroup x:Name="CheckStates">
                                                            <VisualState x:Name="Checked">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BackgroundOverlay3"/>
                                                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Highlight"/>
                                                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BackgroundGradient2"/>
                                                                    <ColorAnimation Duration="0" To="#E5FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient2"/>
                                                                    <ColorAnimation Duration="0" To="#BCFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient2"/>
                                                                    <ColorAnimation Duration="0" To="#6BFFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient2"/>
                                                                    <ColorAnimation Duration="0" To="#F2FFFFFF" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="BackgroundGradient2"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Unchecked"/>
                                                        </VisualStateGroup>
                                                        <VisualStateGroup x:Name="FocusStates">
                                                            <VisualState x:Name="Focused">
                                                                <Storyboard>
                                                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FocusVisualElement">
                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                <Visibility>Visible</Visibility>
                                                                            </DiscreteObjectKeyFrame.Value>
                                                                        </DiscreteObjectKeyFrame>
                                                                    </ObjectAnimationUsingKeyFrames>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Unfocused"/>
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Rectangle x:Name="Background" Fill="{TemplateBinding Background}" RadiusY="3" RadiusX="3" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}"/>
                                                    <Rectangle x:Name="BackgroundOverlay" Fill="#FF448DCA" Opacity="0" RadiusY="3" RadiusX="3" Stroke="#00000000" StrokeThickness="{TemplateBinding BorderThickness}"/>
                                                    <Rectangle x:Name="BackgroundOverlay2" Fill="#FF448DCA" Opacity="0" RadiusY="3" RadiusX="3" Stroke="#00000000" StrokeThickness="{TemplateBinding BorderThickness}"/>
                                                    <Rectangle x:Name="BackgroundGradient" Margin="{TemplateBinding BorderThickness}" RadiusY="2" RadiusX="2" Stroke="#FFFFFFFF" StrokeThickness="1">
                                                        <Rectangle.Fill>
                                                            <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                                                                <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                                                <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
                                                                <GradientStop Color="#E5FFFFFF" Offset="0.625"/>
                                                                <GradientStop Color="#C6FFFFFF" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Rectangle.Fill>
                                                    </Rectangle>
                                                    <Rectangle x:Name="BackgroundOverlay3" Fill="#FF448DCA" Opacity="0" RadiusY="3" RadiusX="3" Stroke="#00000000" StrokeThickness="{TemplateBinding BorderThickness}"/>
                                                    <Rectangle x:Name="BackgroundGradient2" Margin="{TemplateBinding BorderThickness}" Opacity="0" RadiusY="2" RadiusX="2" Stroke="#FFFFFFFF" StrokeThickness="1">
                                                        <Rectangle.Fill>
                                                            <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                                                                <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                                                <GradientStop Color="#F9FFFFFF" Offset="0.375"/>
                                                                <GradientStop Color="#E5FFFFFF" Offset="0.625"/>
                                                                <GradientStop Color="#C6FFFFFF" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Rectangle.Fill>
                                                    </Rectangle>
                                                    <Rectangle x:Name="Highlight" IsHitTestVisible="false" Margin="{TemplateBinding BorderThickness}" Opacity="0" RadiusY="2" RadiusX="2" Stroke="#FF6DBDD1" StrokeThickness="1"/>
                                                    <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                                    <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="false" Margin="1" RadiusY="3.5" RadiusX="3.5" Stroke="#FF6DBDD1" StrokeThickness="1" Visibility="Collapsed"/>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Grid.Resources>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimation Duration="00:00:00" To=".55" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisabledVisualElement"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimation Duration="00:00:00" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FocusVisualElement"/>
                                        </Storyboard>