I implemented ICommandSource on a Slider, then I used it on a TextBox and it works perfectly.
<local:CommandedSlider x:Name="FontSlider" Background="AliceBlue" Minimum="0" Maximum="40" Value="10" TickFrequency="5" Height="40" TickPlacement="BottomRight" LargeChange="5" SmallChange="5" AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="0" Command="{x:Static local:MainWindow.FontUpdateCommand}" CommandTarget="{Binding ElementName=txtBoxTarget}" CommandParameter="{Binding ElementName=FontSlider, Path=Value, Converter={StaticResource DoubleConverterResource}}" Focusable="False" Margin="12,12,12,135" /><TextBox Height="58" HorizontalAlignment="Left" Margin="12,0,0,57" Name="txtBoxTarget" VerticalAlignment="Bottom" Width="184" FontSize="10" ><TextBox.CommandBindings><CommandBinding Command="{x:Static local:MainWindow.FontUpdateCommand}" Executed="SliderUpdateExecuted" CanExecute="SliderUpdateCanExecute" /></TextBox.CommandBindings> ICommand Supported</TextBox>
FontUpdateCommand is a RoutedUICommand defined at the window's code behind.
As you can see, the command bindings are defined at the txtBoxtarget level, it works fine as long as the CommandedSlider sets its CommandTarget as the txtBoxTarget.
But, what if I wanted the CommandedSlider to act on several textboxes at once? How can I target the command to several controls.
Furthermore, the CommandBindings are defined at the txtBoxTarget level, if i define them at the Window level, the command ceases working,why?
Rafael
Believe you can do it, and you will!!