forum

Home / DeveloperSection / Forums / Bind XAML property indirectly

Bind XAML property indirectly

Samuel Fernandes 1894 23-Sep-2013

Imagine, I have a button and a binding:

<Button Content="{Binding Path=FailOverStrings.ConfigTestBtn, Source={StaticResource    ResourceWrapper}}></Button>

Now I want to setup an array of such buttons:

        <Grid >
            <ItemsControl>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Button Content="{Binding Title}" />
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Grid>

I will create a collection in the code behind but how to say that 'Title' which is equal to 'ConfigTestBtn' is not really a string 'ConfigTestBtn' itself but is a name of a property of FailOverStrings ?

Some kind of an indirection in binding. I suppose I can write a converter to do it, but is it really necessary?


wpf wpf 
Updated on 23-Sep-2013

Can you answer this question?


Answer

1 Answers

Liked By