Well you can bind the Content of the TextBox TextForTextBox, and bind the Checked state to Checked. in your viewModel you would : do
private string _text;
private bool _checked;
public string TextForTextBox
{
get { return _text; }
private set { _text = value;}
}
public bool Checked
{
get { return _checked; }
set
{
if (_checked != value)
{
_checked = value;
Text = _checked ? 1 : = 0;
PropertyChanged("Checked");
PropertyChanged("TextForTextBox");
}
}
}
This is assuming that you have a ViewModel that implements the INotfiyPropertyChanged.
EDIT
Code to change this in pure XAML :
<Grid>
<StackPanel>
<CheckBox x:Name="check" />
<TextBox>
<TextBox.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=check, Path=IsChecked}" Value="True">
<Setter Property="TextBox.Text" Value="1" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=check, Path=IsChecked}" Value="False">
<Setter Property="TextBox.Text" Value="0" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</StackPanel>
</Grid>