I have a partial class code behind for a XAML form. Here is the code behind:
partial class GalleryDictionary
{
private void GalleryItemLabelPropertyChanged(object sender, RoutedEventArgs e)
{
var mainWindow = Application.Current.MainWindow as MainWindow;
if (mainWindow == null)
return;
var tb = sender as TextBox;
if (tb == null)
return;
var sip = tb.DataContext as StereoImagePair;
if (sip == null)
return;
sip.Label = tb.Text;
mainWindow.Db.SubmitChanges();
}
}
That is the entire DOC.XAML.CS file after the namespace declaration.
In my XAML file I need to access a variable from this XAML.CS file that I'd like to call DriveOnRight. Here is the line I've been fighting:
<ToggleButton Grid.Row="1" Grid.Column="2" Width="26" Height="26" IsChecked="True" Click="GalleryItemLabelPropertyChanged" CommandParameter="2" Name="PS" Content="{Binding DriveOnRight}"></ToggleButton>
Where the XAML file reads....Content="{Binding DriveOnRight}" is where I need to access the variable from the CS file and display it there.
How do I do that?
Any help sure will be appreciated.