我正在尝试将 XML 页面绑定到相同的底层代码页。
<toolkit:ToggleSwitch Foreground="Transparent" Checked="ToggleSwitch_Checked" IsChecked="{Binding Source={StaticResource appSettings}, Path=LockSetting, Mode=TwoWay}">
<toolkit:ToggleSwitch.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" DataContext="{Binding}">
<TextBlock Text="locks or unlocks your calender" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="statusBox" Text="{Binding stat1}" Style="{StaticResource PhoneTextTitle3Style}" />
</StackPanel>
</DataTemplate>
</toolkit:ToggleSwitch.ContentTemplate>
我已将数据上下文设置为
stat1 = "abn";
InitializeComponent();
aps = this.Resources["appSettings"] as AppSettings;
this.colorpicker.Color = Color.FromArgb(aps.ASetting, aps.RSetting, aps.GSetting, aps.BSetting);
ContentPanel.DataContext = this;
但这根本行不通。任何帮助都会很好。