What is the meaning of x: name in xaml (WPF) and using it with a storyboard

<Border Name="ItemBorder" Margin="5 5 0 5" BorderBrush="Black" BorderThickness="1" Height="75" Width="75">
  <Border.Background>
    <SolidColorBrush x:Name="ItemBorderBrush" Color="LightBlue"/>
  </Border.Background>
  <ContentPresenter/>
</Border>
<ControlTemplate.Triggers>
  <EventTrigger RoutedEvent="someEvent">
    <BeginStoryboard>
      <Storyboard TargetName="ItemBorderBrush" TargetProperty="Color" Duration="0:0:1" >
      <!--Storyboard TargetName="ItemBorder" TargetProperty="Background.Color" Duration="0:0:1"> -->
         <ColorAnimation To="White"/>
      </Storyboard>
    </BeginStoryboard>
  </EventTrigger>
</ControlTemplate.Triggers>

I will try to clearly explain my question. The name of the storyboard target when it is β€œItemBorder” (comment line) works intermittently. Sometimes I get an error that the name "ItemBorder" could not be found in the area.

I decided to follow the style from the MSDN example of this and change the color property directly to the brush, instead of having the storyboard aim to be a border and change the color of the border brush by property (comment line). It seems to work.

However, it Name="ItemBorderBrush"does not compile because it is Namenot a property SolidColorBrush, so I use x:Name="ItemBorderBrush"both parameters Nameand x:Nameare accepted for the border. Why is this?

x: ( x:Name Name), Name ?

+5
2

x: - :

XAML, , XML. WPF / XAML :

XMLNS = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"

XAML, ( ) x:

XMLNS: = "http://schemas.microsoft.com/winfx/2006/xaml"

, x: , XAML , WPF - , XAML XAML. WPF , XAML , WPF

, , Name x:Name Border, , Border Name. XAML Intrinsic x:Name ( , WPF ).

SolidColorBrush Name, XAML- x:Name.

+4

XAML : x: Name. , WPF, XAML x: Name, RuntimeNamePropertyAttribute , x: Name XAML.

, , "" , WPF. WPF, , FrameworkElement Name.

, x: Name, . x: Name , XAML . , , .

, ? , , . WPF , ( Bind, ), XAML , . WPF , Name x: Name.

XAML x: Name, , , , 3.5 .

, , . .

. AutomationProperties.Name VS x: Name, AutomationProperties.Name .

refer WPF, x: Name Name?

+1

All Articles