ControlTemplate
of a WPF control? <ControlTemplate TargetType="ListBoxItem">
<Button x:Name="stack" Click="Select_Country_Click" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Left" Background="Transparent" BorderThickness="0" >
<Button.Style>
<Style TargetType="{x:Type Button}" x:Name="butt">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate x:Name="mycontrol" TargetType="Button">
<Border Name="border" BorderThickness="2" VerticalAlignment="Stretch" BorderBrush="Transparent" CornerRadius="3" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#14FFDC0C" />
<Setter TargetName="border" Property="BorderBrush" Value="#FFDC0C" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
<Grid x:Name="gridList2" Height="70">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image x:Name="imagetemp2" Source="{Binding Flag}" Grid.Column="0" Height="70" Width="70" >
<Image.Clip>
<EllipseGeometry
RadiusX="22"
RadiusY="22"
Center="35,35"/>
</Image.Clip>
</Image>
<TextBlock x:Name="texttemp2" Tag="{Binding CountryShort}" Text="{Binding Title}" FontWeight="Regular" Margin="0,20,20,10" FontFamily="../Resources/Font/#SF Pro Text" Grid.Column="1" FontSize="18" />
</Grid>
</Button>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="transparent"/>
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="IsSelected" Value="True" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
I want each item of the listbox beeing a button with an image and a text all this in the border , and when I click on one of the button I want to access the borderWhat happens when your TargetType is a ListBox?
Yes sorry , i added it , do you know how access it please?If it is the button that you put into the list box that you want to modify, then why are you asking about the list box? The button is not part of the default list box. It was something that you added.