Hi iam trying to access a button in a .xaml file within a code behind file of my MainWindow.xaml . I Have tried to use x:Class in the file but when i use it the button works but i get alot of other errors. so i prefer not to use this method.
Is there any other ways to access controls in a template with a frpm the mainWindows class.
hope u guys understands what i mean
the code
<ResourceDictionary xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
xmlns:l="clr-namespace:Avalon.Demo" x:Class="Bildbanken.MainWindow">
<!-- Taggarnas placering under bilderna (Left/ Top/ Right/ Bottom) -->
<Label Content="{Binding Type}" Padding="0,5,7,0" HorizontalAlignment="Right" />
<Label Content="{Binding Category}" Padding="7,0,0,0" />
<ListBox Name="ArtInfo" ItemsSource="{Binding Articles}" BorderThickness="0" Background="{TemplateBinding Background}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="115px" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Artnr}"></TextBlock>
<Button HorizontalAlignment="Right" Name="testbutton" Grid.Column="1">--</Button>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
..... end