Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Accessing an Array element(i) from a XAML "binding path"

Closed Thread
 
Thread Tools Display Modes
Old 03-01-2007   #1 (permalink)
Newbie


  iterationx is offline

Accessing an Array element(i) from a XAML "binding path"

Hi,
I"m using WPF and trying to access an array element from my XAML Binding Path. I've got a class AuctionItem with an integer array named index and a integer named index0.

<DataTemplate DataType="{x:Type src:AuctionItem}">
...

I can access a property named "index0", but I want to access "index(0)"
This works:
<TextBox Name="DescriptionEntryForm" Grid.Row="0" Grid.Column="4" Text="{Binding Path=index0, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource textStyleTextBox}" />

But I would like this to work instead:
<TextBox Name="DescriptionEntryForm1" Grid.Row="0" Grid.Column="4" Text="{Binding Path=index(0), UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource textStyleTextBox}" />

Thanks for you help.
Patrick
Old 03-23-2007   #2 (permalink)
WPCoder
Guest


 

Re: Accessing an Array element(i) from a XAML "binding path"

You need to use C# syntax for the indexer:

<TextBox Name="DescriptionEntryForm1" Grid.Row="0" Grid.Column="4"
Text="{Binding Path=index[0], UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource textStyleTextBox}" />

So, instead of index(0), it should be index[0].

--Aaron
http://www.wiredprairie.us



"iterationx" <iterationx.2msccl@no-mx.forums.net> wrote in message
news:iterationx.2msccl@no-mx.forums.net...
>
> Hi,
> I"m using WPF and trying to access an array element from my XAML
> Binding Path. I've got a class AuctionItem with an integer array named
> index and a integer named index0.
>
> <DataTemplate DataType="{x:Type src:AuctionItem}">
> ..
>
> I can access a property named "index0", but I want to access "index(0)"
>
> This works:
> <TextBox Name="DescriptionEntryForm" Grid.Row="0" Grid.Column="4"
> Text="{Binding Path=index0, UpdateSourceTrigger=PropertyChanged}"
> Style="{StaticResource textStyleTextBox}" />
>
> But I would like this to work instead:
> <TextBox Name="DescriptionEntryForm1" Grid.Row="0" Grid.Column="4"
> Text="{Binding Path=index(0), UpdateSourceTrigger=PropertyChanged}"
> Style="{StaticResource textStyleTextBox}" />
>
> Thanks for you help.
> Patrick
>
>
> --
> iterationx


Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
When I start my computer I get an "array index error" Gabriela Vista installation & setup 17 09-16-2007 01:32 PM
"Open command prompt here" and "Copy as path" Moody Marco Vista performance & maintenance 10 05-04-2007 11:41 AM
Interpreter demo loading "loose Xaml" interface pfisk Avalon 0 05-06-2006 03:24 PM
How to force KeyboardNavigation's "current element" ??? Marcus Avalon 0 04-28-2006 12:18 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50