Windows Phone 8 xaml textblock binding format

Posted by user2042227 on Stack Overflow See other posts from Stack Overflow or by user2042227
Published on 2013-07-02T10:46:09Z Indexed on 2013/07/02 11:05 UTC
Read the original article Hit count: 156

I would like to format a textblock which is binded to a value, to show "R" before the actuall value, is this possible, cause I cannot directly change the value?

Thank you

        <ListBox x:Name="lstbundleListbox" 
             Foreground="White" Height="320" HorizontalAlignment="Center">
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
                <Setter Property="HorizontalContentAlignment" Value="Center" />
            </Style>
        </ListBox.ItemContainerStyle>
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel>
                    <TextBlock Text="{Binding name}" 
                                   TextWrapping="Wrap" 
                                   HorizontalAlignment="Center"/>

                    <TextBlock Text="{Binding cost}" 
                                   TextWrapping="Wrap" 
                                   HorizontalAlignment="Center"/>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ListBox>

So I basically want the texblock to show R(cost)

© Stack Overflow or respective owner

Related posts about xaml

Related posts about windows-phone-8