views:

11

answers:

1

I am new to the XAML world and I'm fumbling my way through a lot of tutorials. One thing i'm stuck on is calling the .tostring on an object.

Here is mysetup

I have a listbox that is bound to a list of objects I have a contentControl bound to the same list that displays the selected item from the listbox.

My ContentControl is as follows:

 <ContentControl Grid.Row="1" Margin="0,3,5,204" Name="Detail" 
  Content="{Binding Source={StaticResource listingDataView}}"
  ContentTemplate="{StaticResource myContentTemplate}" 
   HorizontalAlignment="Right" Width="231"/>

in myContentTemplate I have:

<DataTemplate x:Key="myContentTemplate">
            <StackPanel>
                <TextBlock Text="{Binding Path=Name}" />
                <!-- want to call .tostring here-->
            </StackPanel>
        </DataTemplate>

In the template I'd like to call .tostring on the object that is currently selected but i cant figure out how to do that?

thanks Steph

A: 

well looks like i asked this too soon. I found the answer in another question

http://stackoverflow.com/questions/231321/how-to-reference-current-object-in-xaml/231500#231500

Quoting the answer from that thread:

According to the Data Binding Overview, you can use the "/" to indicate the current item. You can then navigate up and down the tree as needs be using the following type syntaxes:

Button Content="{Binding }" /> 
Button Content="{Binding Path=/}" /> 
Button Content="{Binding
Path=/Description}" />

Hope this helps someone else :)

Without Me It Just Aweso