0
我正在创建新的日历控件。我已将所选日期设置为按钮文本。选择日期时,我需要关闭日历。选择日期时关闭日历
<Window x:Class="DemoApp2.Views.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Window.Resources>
</Window.Resources>
<Grid>
<ToggleButton x:Name="btn" Content="{Binding SelectedDate, ElementName=CalendarControl}" Background="Red" Margin="50,103,55,130">
</ToggleButton>
<Popup IsOpen="{Binding ElementName=btn, Path=IsChecked}" StaysOpen="False" PopupAnimation="Scroll" PlacementRectangle="50,53,50,50">
<Calendar x:Name="CalendarControl"
HorizontalAlignment="Center"
VerticalAlignment="Center">
</Calendar>
</Popup>
</Grid>
</Window>
我更喜欢xaml代码。等待你的宝贵帮助。提前致谢。
我正在使用.net框架4.5。我无法安装System.Windows.Interactivity.dll。我们有任何支持4.5的版本吗? – user3065219
请参阅更新代码,我已发布Blend SDK 4下载链接。 – AnjumSKhan
感谢您的解决方案。从Package Manager Console安装System.Windows.Interactivity.dll后,它工作正常。 – user3065219