1
我想將RadCalendar中的SelectedDate綁定到不同RadScheduleView中的兩個CurrentDate。我怎樣才能做到這一點?c#wpf - 綁定到兩個ElementName
<telerik:RadCalendar Name="radCalendar"
Canvas.Left="80" Canvas.Top="200"
Height="320" Width="400"
SelectedDate="{Binding CurrentDate, ElementName=radScheduleView, Mode=TwoWay}"
SelectionMode="Single" DisplayDate="{Binding DisplayDate, Mode=TwoWay}">
</telerik:RadCalendar>
我想有兩個ElementName=radScheduleView
和ElementName=radScheduleView1
編輯
這裏是我的代碼,需要綁定
<telerik:RadCalendar Name="radCalendar"
Canvas.Left="80" Canvas.Top="200"
Height="320" Width="400"
SelectionMode="Single" DisplayDate="{Binding DisplayDate, Mode=TwoWay}" >
<telerik:RadCalendar.SelectedDate>
<MultiBinding Converter="MultiValueConverter" Mode="TwoWay">
<Binding ElementName="radScheduleView" Path="CurrentDate"/>
<Binding ElementName="radScheduleView1" Path="CurrentDate"/>
</MultiBinding>
</telerik:RadCalendar.SelectedDate>
<telerik:RadScheduleView Name="radScheduleView1"
Canvas.Left="60" Canvas.Top="130"
Height="420" Width="570"
AppointmentsSource="{Binding Appointments}"
SelectedAppointment="{Binding SelectedAppointment, Mode=TwoWay}"
ActiveViewDefinitionIndex="{Binding ActiveViewDefinitionIndex,Mode=TwoWay}"
CurrentDate="{Binding CurrentDate, Mode=TwoWay}">
<telerik:RadScheduleView.ViewDefinitions>
<telerik:DayViewDefinition MinorTickLength="10min" />
</telerik:RadScheduleView.ViewDefinitions>
</telerik:RadScheduleView>
<telerik:RadScheduleView Name="radScheduleView"
Canvas.Left="60" Canvas.Top="130"
Height="420" Width="570"
AppointmentsSource="{Binding Appointments}"
SelectedAppointment="{Binding SelectedAppointment, Mode=TwoWay}"
ActiveViewDefinitionIndex="{Binding ActiveViewDefinitionIndex,Mode=TwoWay}"
CurrentDate="{Binding CurrentDate, Mode=TwoWay}">
<telerik:RadScheduleView.ViewDefinitions>
<telerik:DayViewDefinition MinorTickLength="1h" />
</telerik:RadScheduleView.ViewDefinitions>
嗯,我如何在我的代碼中實現它? – Mirza
@Mirza我在我的回答中修改了XAML來指責你我在說什麼 – Alexis
有一個錯誤'找不到類型'local:MultiValueConverter'。驗證你是否遺漏了一個程序集引用,並且所有引用的程序集都已經構建好了,我把它設置在我的名字空間 – Mirza