locked
Element-to-Element binding inside a DataTemplate RRS feed

  • Question

  • I have a FlipView control named

    imageFlipview

    which resides under the DataTemplete of its parent FlipView named

    flipView

    I have a control which is the sibling control of imageFlipView named

    imageIndicator

    Now, the imageIndicator requires Element-to-Element binding, but is not working inside the DataTemplate. Here is the code

                <FlipView
                x:Name="flipView"
                AutomationProperties.AutomationId="ItemsFlipView"
                AutomationProperties.Name="Item Details"
                TabIndex="1"
                Grid.RowSpan="2"
                ItemsSource="{Binding Source={StaticResource itemsViewSource}}">
    
                <FlipView.ItemContainerStyle>
                    <Style TargetType="FlipViewItem">
                        <Setter Property="Margin" Value="0,137,0,0"/>
                    </Style>
                </FlipView.ItemContainerStyle>
    
                <FlipView.ItemTemplate>
                    <DataTemplate>
                        <UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates">
                            <ScrollViewer x:Name="scrollViewer" Style="{StaticResource HorizontalScrollViewerStyle}" Grid.Row="1">
                                    <StackPanel Orientation="Vertical" Grid.Column="0" Loaded="StackPanel_Loaded_1">
                                        <TextBlock FontSize="30" FontFamily=" Tahoma" FontWeight="Normal" Text="{Binding Title}" TextWrapping="Wrap"/>
                                        <FlipView x:Name="imageFlip" Loaded="imageFlip_Loaded_1" Visibility="Visible" Margin="0,0,0,10" VerticalAlignment="Top" Height="515" >
                                            <Image x:Name="image1" Width="400" HorizontalAlignment="Left" Margin="0,0,0,10" Stretch="Uniform" Source="{Binding ImagePath1}" VerticalAlignment="Top"/>
                                            <Image x:Name="image2" Width="350" HorizontalAlignment="Left" Margin="0,0,0,10" Stretch="Uniform" Source="{Binding ImagePath1}" VerticalAlignment="Top"/>
                                            <Image x:Name="image3" Width="300" HorizontalAlignment="Left" Margin="0,0,0,10" Stretch="Uniform" Source="{Binding ImagePath1}" VerticalAlignment="Top"/>
                                            <Image x:Name="image4" Width="250" HorizontalAlignment="Left" Margin="0,0,0,10" Stretch="Uniform" Source="{Binding ImagePath1}" VerticalAlignment="Top"/>
                                        </FlipView>
                                        <callisto:FlipViewIndicator x:Name="imageIndicator" FlipView="{Binding ElementName=imageFlip}"/>
                                    </StackPanel>
                            </ScrollViewer>
                        </UserControl>
                    </DataTemplate>
                </FlipView.ItemTemplate>
            </FlipView>

    Any Help will be appreciated

    Saturday, March 9, 2013 7:03 AM

All replies

  • Hi,

    have you tried using:

    FlipView="{x:Reference flipView}"

    Or this:

    FlipView="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type FlipView}}"/>




    Sunday, March 10, 2013 10:06 AM
  • Hi Mustansir,

    What kind of project are you using? Is it windows store App? Please verify.

    Thanks,


    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Lisa Zhu Monday, March 11, 2013 9:44 AM
    Monday, March 11, 2013 9:43 AM
  • Yes it is a windows store grid app
    Monday, March 11, 2013 1:49 PM
  • Hi UXJunkie, 

    i have tried the code you suggested and it didn't helped

    Monday, March 11, 2013 2:14 PM
  • Post your error message please.

    Also take a look at this:

    https://github.com/timheuer/callisto/wiki/FlipViewIndicator

    <StackPanel>
        <FlipView x:Name="MyFlipView"/>
        <callisto:FlipViewIndicator FlipView="{Binding ElementName=MyFlipView}" />
    </StackPanel>


    Tuesday, March 12, 2013 7:19 AM