DataGrid
をPopUp
とするカスタムComboBox
を作成しようとしています。私は、標準Template
を上書きしますが、私はItemsHost
DataGrid
(IsItemsHost="True"
)に設定していたとき、私はComboBoxとDataGrid PopUp
<Popup Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid Name="DropDown"
SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder"
Background="White"
BorderThickness="1"
BorderBrush="LightGray"/>
<ScrollViewer Margin="1,2" SnapsToDevicePixels="True">
<DataGrid IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Grid>
</Popup>
がどのように私はこれを実装することができます(予想通り)The member "IsItemsHost" is not recognized or is not accesible
を取得しますか?
進捗状況:Microsoftによると
:
あなたはコンボボックス用のControlTemplateを作成すると、テンプレートがScrollViewerの内ItemsPresenterが含まれている場合があります。 (ItemsPresenterはコンボボックスの各項目を表示し、ScrollViewerはコントロール内でのスクロールを有効にします)。 ItemsPresenterがScrollViewerの直接の子でない場合は、ItemsPresenterにItemsPresenterという名前を付ける必要があります。
(私は答えとして、それを追加します完全なソリューションを持っている場合)だから、この作品:
<Popup Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid Name="DropDown"
SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder"
Background="White"
BorderThickness="1"
BorderBrush="LightGray"/>
<ScrollViewer Margin="1,2" SnapsToDevicePixels="True">
<StackPanel Orientation="Vertical" >
<DataGrid x:Name="ItemsPresenter" ItemsSource="{TemplateBinding ItemsSource}" KeyboardNavigation.DirectionalNavigation="Contained"></DataGrid>
<Border Height="10" Background="Red" />
</StackPanel>
</ScrollViewer>
</Grid>
</Popup>
どこで、どのようにこのポップアップは/現在/表示され示されることになるのでしょうか? – AnjumSKhan
これは、上書きされた 'ComboBox''Templates'の' Popup'部分です。私がそれを知っているなら、私は完全な 'Template'を追加することができます –