关于c# wpf自定义下拉控件问题

.Net技术 码拜 9年前 (2015-05-10) 1077次浏览 0个评论

自定义了一个下拉表格控件
结果点击控件执行下拉动作后一直保持下拉,
不能如常恢复不下拉的状况

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>
40分
用blend做,省去这些麻烦
你的IsOpen属性绑定源有变化吗?
引用 2 楼 johnliuyuan 的回复:

你的IsOpen属性绑定源有变化吗?

我有增加Ispen值改变事件。
发现只有在“有新窗体弹出”(例如MessageBox.Show())的时候Ispen的值才会变化

up up up 求大大解答
引用 1 楼 danding_ge 的回复:

用blend做,省去这些麻烦

用blend做很快就做好了,谢谢大大


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明关于c# wpf自定义下拉控件问题
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!