-Tikigod-
asked on
Controls named inside an item template can't be referenced in the code-behind file.
Hi there,
I'm having an issue where in XAML I define a ListBox with a ListBox.ItemTemplate property element. I put an Image control in the template with a name "envelopeImage" but IntelliSense won't show it to me in the code-behind file (in C#). Is there another way to access the Image? I need to set the source to an embedded resource (namely an image of an envelope). Thanks!
I'm having an issue where in XAML I define a ListBox with a ListBox.ItemTemplate property element. I put an Image control in the template with a name "envelopeImage" but IntelliSense won't show it to me in the code-behind file (in C#). Is there another way to access the Image? I need to set the source to an embedded resource (namely an image of an envelope). Thanks!
<ListBox HorizontalContentAlignment="Stretch" ItemsSource="{Binding Path=myItems}" Margin="10" Name="newItemsListBox">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Blue" BorderThickness="3">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="6*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Image Name="envelope" />
<!--...-->
</StackPanel>
<!--...-->
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.