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