<UserControl x:Class="PhaseCalculator"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <UserControl.Resources> <Style TargetType="{x:Type TextBox}"> <EventSetter Event="PreviewTextInput" Handler="Validation_DigitOnly" /> <EventSetter Event="LostFocus" Handler="Validation_NotEmpty" /> <EventSetter Event="MouseDoubleClick" Handler="TextBox_GotFocus" /> <EventSetter Event="GotKeyboardFocus" Handler="TextBox_GotFocus" /> <EventSetter Event="PreviewMouseLeftButtonDown" Handler="TextBox_GotFocusSelective" /> </Style> </UserControl.Resources>(...)</UserControl>
(in UserControl.Resources.Style, above)
<EventSetter Event="TextChanged" Handler="Refresh" />
(in the content part of the UserControl)<StackPanel> <TextBox Name="Hours" /> <Label Name="TotalHours" /></StackPanel>
(in the content part of the UserControl)
(in the content part of the
UserControl)
<StackPanel>
<TextBox Name="Hours" />
<Label Name="TotalHours" /></StackPanel>
(In the code-behind file) Private Sub Refresh(ByVal sender As Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) TotalHours.Content = Hours.Text * 40End Sub