Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverlight AutoCompleteBox BorderBrush runtime color change?
    primarykey
    data
    text
    <p>Is it possible to update a templated AutoCompleteBox's BorderBrush at runtime? I can't seem to set the BorderBrush or the background.</p> <p>Even base statements like TxtFoodSearch.BorderBrush = new SolidColorBrush(Colors.Red) don't seem to made a difference after the page has loaded.</p> <p>My Xaml is below.</p> <pre><code> &lt;controls:AutoCompleteBox x:Name="MyAutoCompleteSample" Margin="17,24,58,32" FontSize="12"&gt; &lt;controls:AutoCompleteBox.Style&gt; &lt;Style TargetType="controls:AutoCompleteBox"&gt; &lt;Setter Property="IsTabStop" Value="False" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="controls:AutoCompleteBox"&gt; &lt;Grid Margin="{TemplateBinding Padding}" Background="{TemplateBinding Background}"&gt; &lt;TextBox IsTabStop="True" x:Name="Text" Style="{TemplateBinding TextBoxStyle}" Margin="0" KeyDown="MyAutoCompleteSample_KeyDown" /&gt; &lt;Popup x:Name="Popup"&gt; &lt;Border x:Name="PopupBorder" HorizontalAlignment="Stretch" Opacity="0.0" BorderThickness="0" CornerRadius="3"&gt; &lt;Border.RenderTransform&gt; &lt;TranslateTransform X="1" Y="1" /&gt; &lt;/Border.RenderTransform&gt; &lt;Border.Background&gt; &lt;SolidColorBrush Color="#11000000" /&gt; &lt;/Border.Background&gt; &lt;Border HorizontalAlignment="Stretch" Opacity="1.0" Padding="0" ToolTipService.ToolTip="Select or enter your food selection" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3"&gt; &lt;Border.RenderTransform&gt; &lt;TransformGroup&gt; &lt;TranslateTransform X="-1" Y="-1" /&gt; &lt;/TransformGroup&gt; &lt;/Border.RenderTransform&gt; &lt;Border.Background&gt; &lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&gt; &lt;GradientStop Color="#FFDDDDDD" Offset="0"/&gt; &lt;GradientStop Color="#AADDDDDD" Offset="1"/&gt; &lt;/LinearGradientBrush&gt; &lt;/Border.Background&gt; &lt;ListBox x:Name="SelectionAdapter" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemContainerStyle="{TemplateBinding ItemContainerStyle}" ItemTemplate="{TemplateBinding ItemTemplate}" /&gt; &lt;/Border&gt; &lt;/Border&gt; &lt;/Popup&gt; &lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="PopupStates"&gt; &lt;VisualStateGroup.Transitions&gt; &lt;VisualTransition GeneratedDuration="0:0:0.1" To="PopupOpened" /&gt; &lt;VisualTransition GeneratedDuration="0:0:0.2" To="PopupClosed" /&gt; &lt;/VisualStateGroup.Transitions&gt; &lt;VisualState x:Name="PopupOpened"&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetName="PopupBorder" Storyboard.TargetProperty="Opacity" To="1.0" /&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="PopupClosed"&gt; &lt;Storyboard&gt; &lt;DoubleAnimation Storyboard.TargetName="PopupBorder" Storyboard.TargetProperty="Opacity" To="0.0" /&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/controls:AutoCompleteBox.Style&gt; &lt;/controls:AutoCompleteBox&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload