Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

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

 
 
Old 03-01-2007   #1 (permalink)


 
 

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

My System SpecsSystem Spec
Old 03-23-2007   #2 (permalink)
WPCoder


 
 

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


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
"the application binding data format is invalid" while attempting to install SP2 Windows Updates
Array indexing: Want to say "Item #2 through the rest of the array." PowerShell
"Open command prompt here" and "Copy as path" Vista performance & maintenance


Vista Forums 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 Ltd

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