Bir Control'ü ComandParamter olarak göndermeye çalışıyorum, böylece odağı ayarlayabilirim. Bu denetimler bir GridViewColumn HeaderTemplate içinde ve sekme, anlayabildiğim kadarıyla başlıkları geçemez. Araştırmam, ElementName
adının nedeni nedeniyle x:reference
kullanmamı sağladı. Komut düzgün bir şekilde bağlı, bir CommandParameter bağlamadığımda çalışır.KeyBinding'de CommandParameter olarak Bind Denetimi
Attempt to reference named object(s) 'resourcetypeSrch' which have not yet been defined. Forward references, or references to objects that contain forward references, are not supported on directives other than Key.
nasıl TextBox keybinding CommandParameter için x:Name resourcetypeSrch
ile ComboBox bağlayabilir: Aşağıdaki xaml bu bağlanma ile
, bu hatayı alıyorsunuz? o tip ComboBox kontrolünü bulana kadar
<KeyBinding Key="Tab"
Command="{Binding DataContext.SearchNavigationCmd, RelativeSource={RelativeSource AncestorType=Page}}"
CommandParameter="{RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}}"/>
Bu kod kontrolleri ağaca görünecektir:
<GridViewColumn DisplayMemberBinding="{Binding Name }">
<GridViewColumn.HeaderTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{StaticResource Name}" />
<TextBox Text="{Binding DataContext.Foo, RelativeSource={RelativeSource AncestorType=Page}}"
Style="{StaticResource SearchBox }" Width="200">
<TextBox.InputBindings>
<KeyBinding Key="Tab"
Command="{Binding DataContext.SearchNavigationCmd, RelativeSource={RelativeSource AncestorType=Page}}"
CommandParameter="{Binding {x:Reference resourcetypeSrch}}"/>
</TextBox.InputBindings>
</TextBox>
</DockPanel>
</DataTemplate>
</GridViewColumn.HeaderTemplate>
</GridViewColumn>
<GridViewColumn Width="350" DisplayMemberBinding="{Binding ResourceTypeLookup.TypeName }">
<GridViewColumn.HeaderTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{StaticResource ResourceType}" />
<ComboBox x:Name="resourcetypeSrch" Width="300" HorizontalAlignment="Left" IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding DataContext.SrchResourceTypeLookups, RelativeSource={RelativeSource AncestorType=Page}, Mode=OneTime}"
DisplayMemberPath="TypeName"
SelectedValuePath="Bar"
SelectedValue="{Binding DataContext.Fizz, RelativeSource={RelativeSource AncestorType=Page}}" >
</ComboBox>
</DockPanel>
</DataTemplate>
</GridViewColumn.HeaderTemplate>
</GridViewColumn>
' '? –
StepUp