0
我想設計一個silverlight頁面使用一些意見。我能夠獲得所需的用戶界面。但是在瀏覽頁面時遇到問題。爲了得到意見,我編寫了這樣的代碼;標籤問題與意見
<Grid x:Name="LayoutRoot" Background="White">
<ItemsControl ItemsSource="{Binding }" BorderThickness="1" BorderBrush="Black">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Controls:TemplateSelectorDataTemplate FieldType="0001">
<Grid>
<!--Grid definintions-->
.
.
.
<views:Address DataContext="{Binding }" IsTabStop="True" Visibility="{Binding Path=IsWidgetVisible,Converter={StaticResource BoolToVisibilityConverter}}" />
</Grid>
</Controls:TemplateSelectorDataTemplate>
<Controls:TemplateSelectorDataTemplate FieldType="0002">
<Grid>
<!--Grid definintions-->
.
.
.
<views:ContactSearchView DataContext="{Binding }" IsTabStop="True" Visibility="{Binding Path=IsWidgetVisible,Converter={StaticResource BoolToVisibilityConverter}}" />
</Grid>
</Controls:TemplateSelectorDataTemplate>
<Controls:TemplateSelectorDataTemplate FieldType="0003">
<Grid>
<!--Grid definintions-->
.
.
.
<views:GroupView DataContext="{Binding }" IsTabStop="True" Visibility="{Binding Path=IsWidgetVisible,Converter={StaticResource BoolToVisibilityConverter}}" />
</Grid>
</Controls:TemplateSelectorDataTemplate>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
個人意見就像;
<!--AddressView-->
<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding }">
<!--Grid Definitons-->
<TextBlock x:Name="xyz"....../>
<TextBox x:Name = "xyzBox"...../>
.
.
.
.
</Grid>
<!--ContactDetails-->
<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding }">
<!--Grid Definitons-->
<custom NewDatePicker x:Name="DOB"....../>
<TextBox x:Name = "NameBox"...../>
.
.
.
.
</Grid>
的問題,我面對的是,當我從一個視圖到其他視圖的最後努力標籤,我只好按tab兩次insted的一次。一旦進入視圖,它工作正常。
試試這個... http://stackoverflow.com/questions/1892891/how-to-set-focus-on-textbox-in-silverlight-4-out-of-browser-popup/4966198#4966198 – tkerwood