Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to access xaml Control inside DataTemplate inside FlipView
    primarykey
    data
    text
    <p>I want to access the "image" element in the C# code. I know that i cannot access it directly since it is in datatemplate. I have tried visual trees but still not able to get "image" control element in the code . </p> <pre><code>&lt;FlipView x:Name="flipView" AutomationProperties.AutomationId="ItemsFlipView" AutomationProperties.Name="Item Details" TabIndex="1" Grid.RowSpan="2" ItemsSource="{Binding Source={StaticResource itemsViewSource}}" SelectionChanged="flipView_SelectionChanged"&gt; &lt;FlipView.ItemContainerStyle&gt; &lt;Style TargetType="FlipViewItem"&gt; &lt;Setter Property="Margin" Value="0,137,0,0"/&gt; &lt;/Style&gt; &lt;/FlipView.ItemContainerStyle&gt; &lt;FlipView.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;!-- UserControl chosen as the templated item because it supports visual state management Loaded/unloaded events explicitly subscribe to view state updates from the page --&gt; &lt;UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates"&gt; &lt;ScrollViewer x:Name="scrollViewer" Style="{StaticResource HorizontalScrollViewerStyle}" Grid.Row="1"&gt; &lt;!-- Content is allowed to flow across as many columns as needed --&gt; &lt;common:RichTextColumns x:Name="richTextColumns" Margin="117,0,117,47"&gt; &lt;RichTextBlock x:Name="richTextBlock" Width="560" Style="{StaticResource ItemRichTextStyle}" IsTextSelectionEnabled="False"&gt; &lt;Paragraph&gt; &lt;Run FontSize="26.667" FontWeight="Light" Text="{Binding Title}"/&gt; &lt;LineBreak/&gt; &lt;LineBreak/&gt; &lt;Run FontWeight="Normal" Text="{Binding Subtitle}"/&gt; &lt;/Paragraph&gt; &lt;Paragraph LineStackingStrategy="MaxHeight"&gt; &lt;InlineUIContainer&gt; &lt;Image x:Name="image" MaxHeight="480" Margin="0,20,0,10" Stretch="Uniform" Source="{Binding Image}" AutomationProperties.Name="{Binding Title}"/&gt; &lt;/InlineUIContainer&gt; &lt;/Paragraph&gt; &lt;/RichTextBlock&gt; &lt;/common:RichTextColumns&gt; &lt;/ScrollViewer&gt; &lt;/UserControl&gt; &lt;/DataTemplate&gt; &lt;/FlipView.ItemTemplate&gt; &lt;/FlipView&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    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