×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jul 2013
    Location
    chennai, TN
    Posts
    56

    without using Listbox component, I need to bind some variables inside of listbox.

    Hi.....

    public List<NameModel> nameList {get; set;}

    nameList --> has some values , inside of nameList , I have a Name, Age.


    In wp7, what I need is without using Listbox component, I need to bind that Name, Age in xaml page.

    help me out.

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    292

    Re: without using Listbox component, I need to bind some variables inside of listbox.

    You can bind in a DataContext of an element and then access the elements manually one by one in xaml, or do it dynamically in C#.

    Example :

    Code:
    <Grid DataContext={Binding nameList} >
    <TextBlock Text={Binding [0],path="Name"} />
    <TextBlock Text={Binding [1],path="Name"} />
    </Grid>

  3. #3
    Registered User
    Join Date
    Jul 2013
    Location
    chennai, TN
    Posts
    56

    Re: without using Listbox component, I need to bind some variables inside of listbox.

    hi.. loukt

    thank you..

    Its not working ... I'm getting an exception System.Windows.Data.Binding.Path' is set more than once.
    Last edited by Murugan india; 2013-10-29 at 06:22.

  4. #4
    Registered User
    Join Date
    Jul 2013
    Location
    chennai, TN
    Posts
    56

    I'm getting an exception, system.windows.binding.path is set more than once

    hi... dude

    Can I able to use a two datacontext in a single gird .Is that possible how to use P.s help me out

    I'm getting an exception, system.windows.binding.path is set more than once,

    so how to solve and is it possible to use code like this.

    e.g:

    <Grid DataContext="{Binding AddrViewModel}" x:Name="OrganViewContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <Image Height="717" HorizontalAlignment="Left" Name="bkimg" Stretch="Fill" VerticalAlignment="Top" Width="450" Source="Images/Background.png" ImageFailed="bkimg_ImageFailed" />

    <Grid DataContext="{Binding addressList}" x:Name="addrPanel">
    <TextBlock Text="{Binding [0],Path=other}" Foreground="Black"></TextBlock>
    </Grid>
    </Grid>

  5. #5
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: I'm getting an exception, system.windows.binding.path is set more than once

    You can try the following:
    Code:
    <Grid x:Name="addrPanel">
    <TextBlock Text="{Binding addressList[0].other}" Foreground="Black"></TextBlock>
    </Grid>
    </Grid>
    And you cannot have two data contexts, but you can create a new view model which contains two sub-viewmodels and you'll in effect get the same thing.

Similar Threads

  1. bind linq to textblock without listBox.ItemsSource
    By thejeraldo in forum Windows Phone General
    Replies: 2
    Last Post: 2012-02-27, 11:52
  2. How to get ListBox inside dialog.?
    By SymbianLover2007 in forum Symbian
    Replies: 1
    Last Post: 2007-09-14, 09:00
  3. Listbox inside listbox
    By Zefa in forum Symbian User Interface
    Replies: 2
    Last Post: 2007-05-09, 02:32
  4. Listbox.bind and EKeySelect problem
    By madsbjoern in forum Symbian
    Replies: 2
    Last Post: 2007-03-29, 20:30
  5. Listbox Inside a form
    By mubx2000 in forum Symbian User Interface
    Replies: 13
    Last Post: 2006-11-29, 06:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •