关于c# wpf自定义下拉控件有关问题
关于c# wpf自定义下拉控件问题
自定义了一个下拉表格控件,
结果点击控件执行下拉动作后一直保持下拉,
不能如常恢复不下拉的状况
Generic.xaml关键代码如下:
------解决思路----------------------
用blend做,省去这些麻烦
自定义了一个下拉表格控件,
结果点击控件执行下拉动作后一直保持下拉,
不能如常恢复不下拉的状况
Generic.xaml关键代码如下:
<Popup IsOpen="{Binding IsDropdownOpened, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:DropDownTable}}, UpdateSourceTrigger=PropertyChanged}" AllowsTransparency="True" MaxHeight="{Binding MaxDropdownHeight, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:DropDownTable}}}" Width="{TemplateBinding ActualWidth}" StaysOpen="False" PopupAnimation="Fade" MinHeight="{Binding MinDropdownHeighte, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:DropDownTable}}}" >
<Border Background="White" Margin="3">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<VirtualizingStackPanel x:Name="PART_ItemPanel" MaxHeight="{TemplateBinding MaxDropdownHeight}" MinHeight="{TemplateBinding MinDropdownHeight}">
<DataGrid x:Name="PART_Data" DataContext="{TemplateBinding DataSource}"/>
</VirtualizingStackPanel>
</ScrollViewer>
<Border.Effect>
<DropShadowEffect BlurRadius="8" ShadowDepth="6" Opacity="0.8" Color="#FF939090" />
</Border.Effect>
</Border>
</Popup>
------解决思路----------------------
用blend做,省去这些麻烦