1
votes

I have this XAML code:

<ListBox DataContext="{Binding Tables[Suppliers]}" ItemsSource="{Binding}">
</ListBox>

In the project I have the following code:

namespace Suppliers
{
    class DBServer
    {
        public const string TableSuppliers = "Suppliers";
    }

How can I use Suppliers.DBServer.TableSuppliers in the XAML page instead of hard-coded Suppliers:

{Binding Tables[ ??? ]} 
1

1 Answers

1
votes

If this what is inside [] is a string you can always use a constant like {x:Static c:Constants.X}