2
看起來這應該是簡單的...
我有一個用戶控件,我將在選項卡控件的多個選項卡上使用。我想要同步usercontrol的所有實例。簡單的silverlight數據綁定列表框<>
在我的用戶我有一個字符串列表:
按鈕和列表框:
<ListBox x:Name="fontList" ItemsSource="{Binding Path=fonts}" />
但是,列表框是永遠不會填充。
在搜索示例代碼中,似乎我已經在幾個示例中看到了這個實現,但是我無法使其工作。
感謝您的任何提示...
更新與磨料水射流的建議,但仍然沒有工作:
MainPage.xaml.cs中:
public partial class MainPage : UserControl
{
public static List<string> _fonts
= new List<string>() { "Arial", "Courier" };
public List<string> Fonts { get { return _fonts; } }
}
在TestGroup.xaml:
<ListBox x:Name="fontList1" ItemsSource="{Binding Parent.Fonts, ElementName=LayoutRoot}" Margin="3" />