This is a migrated thread and some comments may be shown as answers.

Problem with pivot

0 Answers 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vitor
Top achievements
Rank 1
Vitor asked on 15 Jan 2016, 03:51 PM

I'm doing a project, i have one pivot and this pivot have two pivotitem. The first one is called Lista and the second one is called Carrinho. In the first one i have a listview to store products and i have a binding to my productview model. When i select a button one the product he shows flyout and what i want is when i click the button that is on that flyout all the data that i have on the product will be send to the second pivotitem and i don't know how to do that mainly because the first pivotitem have the binding to productviewmodel and the second need to have the binding to other view model because the second pivotitem will be the order for the product and i think that maybe i just need to send the id of product because they are related in the database between this two tables (product and order).

Here is the code that i have in xaml to better explain.

        <Pivot Grid.Column="1">

            <PivotItem Header="Lista">
                <ListView x:Name="List1" ItemsSource="{x:Bind ProdutoViewModel.Produtos}" Height="550" SelectionChanged="List1_SelectionChanged">
                    <ListView.ItemTemplate>
                        <DataTemplate x:DataType="list:Produto">
                            <ListView FlyoutBase.AttachedFlyout="{StaticResource FlyoutBase1}" RightTapped="StackPanel_RightTapped">
                                <Button x:Name="CarrButton">
                                    <Image Source="/Assets/cart.png" Height="20"/>
                                    <Button.Flyout>
                                        <Flyout>
                                            <StackPanel>
                                                <TextBlock Style="{StaticResource BaseTextBlockStyle}">
                                                    Adicionar este produto?
                                                </TextBlock>
                                                <Button Click="CarrConfirmation_Click">
                                                    Carrinho
                                                </Button>
                                            </StackPanel>
                                        </Flyout>
                                    </Button.Flyout>
                                </Button>
                                <StackPanel>
                                    <TextBlock Text="{x:Bind Nome}" Margin="100,10,10,10"/>
                                    <TextBlock Text="{x:Bind Preco}" Margin="100,10,10,10"/>
                                    <TextBlock Text="{x:Bind Disponivel}" Margin="100,10,10,10"/>
                                    <TextBlock Text="{x:Bind Fornecedor}" Margin="100,10,10,10"/>
                                    <TextBlock Text="{x:Bind Categoria}" Margin="100,10,10,10"/>
                                </StackPanel>
                            </ListView>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>

            </PivotItem>
            <PivotItem Header="Carrinho">
                <ListView x:Name="Cart" ItemsSource="{Binding EncomendaViewModel.Encomendas}" Height="550">
                    <ListView.ItemTemplate>
                        <DataTemplate x:DataType="list:Produto">

                            <StackPanel>
                                <TextBlock Text="dasfas"></TextBlock>
                               

                            </StackPanel>

                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </PivotItem>

        </Pivot>

 

On the code behind i don't know what to do and only have this

private void CarrConfirmation_Click(object sender, RoutedEventArgs e)
        {
            
            Button button = sender as Button;
            Produto produto = button.DataContext as Produto;

       }

 

Thanks

 

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Vitor
Top achievements
Rank 1
Share this question
or