Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set TabIndex of TextBox inside NumericUpDown control Silverlight
    primarykey
    data
    text
    <p>I am using a NumericUpDown control in my Silverlight application. I have an issue when using tab to navigate through controls in Silverlight page. </p> <p><strong>Case 1:</strong> When my control focus is on NumericUpDown and I use up down key my value increments and decrements in NumericUpDown control. and when press tab focus moves to next control who's tabindex is +1 </p> <p><strong>Case 2:</strong> When I clicks on NumericUpDown control so my NumericUpDownControl get focused since I clicked on it, when I enter value in it through keyboard and press tab id does not move to next control. (As it moves in 1st case)</p> <p>I found that when I click on NumericUpDown control and then press tab in Case 2: in the key down event of control i get Original source as TextBox.</p> <pre><code>** private void Control_KeyDown(object sender, KeyEventArgs e) { if (e.OriginalSource as Control != null &amp;&amp; e.Key == Key.Tab) { Int32 index = (e.OriginalSource as Control).TabIndex; if (index == Int32.MaxValue) index = index1; //??// if (Keyboard.Modifiers == ModifierKeys.None) { } else if (Keyboard.Modifiers == ModifierKeys.Shift) { } } } </code></pre> <p>**</p> <p><strong>In case 1</strong> : I got NumericUpDown control as Original Source <strong>In Case 2</strong> : I got TextBox control as Original source</p> <p>Where I have set TabIndex of NumericUpDown control and since I didn't get TabIndex property of TextBox I am getting above issue.</p> <p>So how do I set the TabIndex on the TextBox of a NumericUpDown control.??</p> <p><strong>Control Template</strong></p> <p>` <br> </p> <pre><code> &lt;VisualStateGroup x:Name="ValidationStates"&gt; &lt;VisualState x:Name="Valid"/&gt; &lt;VisualState x:Name="InvalidUnfocused"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0"&gt; &lt;DiscreteObjectKeyFrame.Value&gt; &lt;Visibility&gt;Visible&lt;/Visibility&gt; &lt;/DiscreteObjectKeyFrame.Value&gt; &lt;/DiscreteObjectKeyFrame&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="InvalidFocused"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationErrorElement" Storyboard.TargetProperty="Visibility"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0"&gt; &lt;DiscreteObjectKeyFrame.Value&gt; &lt;Visibility&gt;Visible&lt;/Visibility&gt; &lt;/DiscreteObjectKeyFrame.Value&gt; &lt;/DiscreteObjectKeyFrame&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsOpen"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0"&gt; &lt;DiscreteObjectKeyFrame.Value&gt; &lt;sys:Boolean&gt;True&lt;/sys:Boolean&gt; &lt;/DiscreteObjectKeyFrame.Value&gt; &lt;/DiscreteObjectKeyFrame&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; &lt;inputToolkit:ButtonSpinner x:Name="Spinner" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" MinWidth="35"&gt; &lt;StackPanel Background="White" Orientation="Horizontal" HorizontalAlignment="Right" Width="Auto"&gt; &lt;TextBox x:Name="Text" Style="{StaticResource TextBoxStyle}" BorderThickness="0" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" Foreground="{TemplateBinding Foreground}" MinWidth="50" Width="Auto" AcceptsReturn="False" Text="{TemplateBinding Value}" TextAlignment="Left" TextWrapping="NoWrap"/&gt; &lt;/StackPanel&gt; &lt;/inputToolkit:ButtonSpinner&gt; &lt;Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0" Background="#A5FFFFFF" CornerRadius="2.5,2.5,2.5,2.5"/&gt; &lt;Border x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="#FF45D6FA" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1,1,1,1"/&gt; &lt;Border x:Name="ValidationErrorElement" Visibility="Collapsed" BorderBrush="#FFDB000C" BorderThickness="1" CornerRadius="1"&gt; &lt;ToolTipService.ToolTip&gt; &lt;ToolTip x:Name="validationTooltip" Height="Auto" Width="Auto" Template="{StaticResource ValidationToolTipTemplate}" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"&gt; &lt;ToolTip.Triggers&gt; &lt;EventTrigger RoutedEvent="Canvas.Loaded"&gt; &lt;BeginStoryboard&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="validationTooltip" Storyboard.TargetProperty="IsHitTestVisible"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0"&gt; &lt;DiscreteObjectKeyFrame.Value&gt; &lt;sys:Boolean&gt;true&lt;/sys:Boolean&gt; &lt;/DiscreteObjectKeyFrame.Value&gt; &lt;/DiscreteObjectKeyFrame&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/BeginStoryboard&gt; &lt;/EventTrigger&gt; &lt;/ToolTip.Triggers&gt; &lt;/ToolTip&gt; &lt;/ToolTipService.ToolTip&gt; &lt;Grid Height="12" HorizontalAlignment="Right" Margin="1,-4,-4,0" VerticalAlignment="Top" Width="12" Background="Transparent"&gt; &lt;Path Fill="#FFDC000C" Margin="1,3,0,0" Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z"/&gt; &lt;Path Fill="#ffffff" Margin="1,3,0,0" Data="M 0,0 L2,0 L 8,6 L8,8"/&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt;` </code></pre> <p>**I want to set TextBox from <code>&lt;inputToolkit:ButtonSpinner&gt;&lt;/inputToolkit:ButtonSpinner&gt;</code> Text's TabIndex property at runtime. </p> <p>How do i do this.?**</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload