Send data between pivot

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 1554 Views - Last Post: 06 February 2016 - 09:57 AM Rate Topic: -----

#1 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Send data between pivot

Posted 20 January 2016 - 12:44 PM

Hi, I'm using c# and xaml to do a project.
I have in xaml a pivot with 3 pivot items and in the first one i have some data that i add it, now i have a flyout in that information and when i click the button i want to send the data to the second pivoitem, how can i do that?
Is This A Good Question/Topic? 0
  • +

Replies To: Send data between pivot

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15110
  • View blog
  • Posts: 60,436
  • Joined: 12-June 08

Re: Send data between pivot

Posted 20 January 2016 - 12:48 PM

What have you tried?
Was This Post Helpful? 0
  • +
  • -

#3 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Re: Send data between pivot

Posted 20 January 2016 - 01:47 PM

In the first pivotitem i have this
        <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>


This are the products and now i want the second pivotitem to be like the orders of product
My problem is that they are different tables in database so they are different in all the project like each one have is on viewmodel. What should i bind for the second pivot and what i should do on code behind?
i tried to use the same bind and the bind for the new viewmodel but i'm realy confused.
<PivotItem Header="Carrinho">
            <ListView x:Name="Cart" ItemsSource="{Binding EncomendaViewModel.Encomendas}" Height="550">
                <ListView.ItemTemplate>
                    <DataTemplate x:DataType="list:Encomenda">

                        <StackPanel>
                            <TextBlock Text="{x:Bind Nome}"/>


                        </StackPanel>

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


Was This Post Helpful? 0
  • +
  • -

#4 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6967
  • View blog
  • Posts: 23,677
  • Joined: 05-May 12

Re: Send data between pivot

Posted 20 January 2016 - 01:57 PM

If all your view models exposed the same fields, but had different behaviors depending on which pivot is active, then you can just swap the view models with impunity. It sounds like your view models are very tightly coupled to your database tables. Don't do that. The model can be tightly couple to the database, but the view model is the adapter that transforms the model into something that the view can use. You should design the view model based on what the view needs, not what the model offers.
Was This Post Helpful? 0
  • +
  • -

#5 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Re: Send data between pivot

Posted 20 January 2016 - 02:10 PM

They don't have the same fields. The product fields are in the bind in the first part of the code and also have the id. The "encomendaviewmodel" that we can call "order" have different fields and also the id for the product
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6967
  • View blog
  • Posts: 23,677
  • Joined: 05-May 12

Re: Send data between pivot

Posted 20 January 2016 - 02:29 PM

Yes, but that doesn't keep you from having your view model having the field names as generic as:
column1
column2
column3
:
columnN



and having your view binding to those fields. The code behind the view models would map between the generically named column to the real table columns.
Was This Post Helpful? 0
  • +
  • -

#7 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Re: Send data between pivot

Posted 21 January 2016 - 07:03 AM

Anyone can help?
Was This Post Helpful? 0
  • +
  • -

#8 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Re: Send data between pivot

Posted 25 January 2016 - 11:06 AM

Hi, is it possible to send information from one pivot item to another pivot item, the pivot items have different fields and observable collection and each one have the data into a list view and i want to see in the second pivot item some data from the first one.

I have this for the first pivot
<ListView x:Name="List1" ItemsSource="{x:Bind      ProdutoViewModel.Produtos}" Height="550">
      <ListView.ItemTemplate>
        <DataTemplate x:DataType="list:Produto">

If in the second pivotem i need to bind for the other collection how can i get the data from the first one?
Was This Post Helpful? 0
  • +
  • -

#9 andrewsw   User is online

  • never lube your breaks
  • member icon

Reputation: 6798
  • View blog
  • Posts: 28,096
  • Joined: 12-December 12

Re: Send data between pivot

Posted 25 January 2016 - 12:48 PM

Do not start a new topic for the same question. Topics merged.
Was This Post Helpful? 0
  • +
  • -

#10 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Re: Send data between pivot

Posted 25 January 2016 - 01:29 PM

Sorry i just started a new one because i didn't get help and though was the best way to have it
Was This Post Helpful? 0
  • +
  • -

#11 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Re: Send data between pivot

Posted 27 January 2016 - 11:12 AM

Hi have a pivot like this

            <PivotItem Header="Product">
                <GridView ItemsSource="{x:Bind ProductViewModel.Products}">
                    <GridView.ItemTemplate>
                        <DataTemplate x:DataType="models:Product">
                            <StackPanel FlyoutBase.AttachedFlyout="{StaticResource FlayoutBase1}" RightTapped="StackPanel_RightTapped">
                                <TextBlock Text="{x:Bind Name, Mode=OneWay}"/>
                                <TextBlock Text="{x:Bind Price, Mode=OneWay}"/>
                            </StackPanel>
                        </DataTemplate>
                    </GridView.ItemTemplate>
                </GridView>
            </PivotItem>


I also have a flyout in every product with a button and when i press it i want to send his Name and Price to a new page for the order of that product.
I don't know how to do it because the they have different ViewModels and the filds are not the same
Was This Post Helpful? 0
  • +
  • -

#12 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6967
  • View blog
  • Posts: 23,677
  • Joined: 05-May 12

Re: Send data between pivot

Posted 28 January 2016 - 07:16 AM

This is essentially the same question as your other thread: you are trying to figure out how to communicate the current selected item's values over to a fresh view model. Merging with your other thread.
Was This Post Helpful? 0
  • +
  • -

#13 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Re: Send data between pivot

Posted 29 January 2016 - 11:29 AM

And i still have no help not even about how to send to another pages. nothing
Was This Post Helpful? 0
  • +
  • -

#14 Asus1   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 20-January 16

Re: Send data between pivot

Posted 05 February 2016 - 09:50 AM

I have a listview that shows items and i have bind on his elements.
If i want to access or send one element or all from a different page how can i do it?
Was This Post Helpful? 0
  • +
  • -

#15 Curtis Rutland   User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5106
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Send data between pivot

Posted 05 February 2016 - 10:10 AM

Please read this tutorial I wrote about "The Right Way to get Values from Form1 to Form2":

http://www.dreaminco...form1-to-form2/

If you are working in WPF, the concepts are similar, but it's even simpler, since you would just pass DataContext stuff back and forth.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2