2
我可能忽略了一些明顯的東西,但我現在看不到它的存在。命令綁定在設計師/ VS中工作,但不能構建/發佈
我有在其上具有結合到的ICollectionView項目源的用戶控制(數據網格)的相互作用,但是在DataContext是從父窗口繼承:
<DataGrid Margin="0" ItemsSource="{Binding ItemsView}" AutoGenerateColumns="False" IsReadOnly="True"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
<DataGrid.Columns>
....
</DataGrid.Columns>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding OnNotifyPeg}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</DataGrid>
在DataContext是繼承自父窗口,其中有一個標籤視圖:
<Window x:Class="ConfigBrowser.Views.ConfigView"
DataContext="{Binding ConfigViewModel, Source={StaticResource Locator}}">
<Grid Background="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}">
<TabControl Height="Auto" Width="Auto"
Background="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}">
<TabItem Header="Overview">
<controls:Overview/>
</TabItem>
就目前而言,OnNotifyPeg命令只是打開一個窗口(通過服務,而且一個消息調試現在)
public ICommand OnNotifyPeg
{
get { return new DelegateCommand(NotifyPeg); }
}
public void NotifyPeg()
{
MessageBox.Show("Notify peg", "Clicked");
_detailService.ViewPeg(SelectedItem);
}
雖然從Visual Studio中運行,但它工作正常 - uc將關閉命令。
但是,當我從調試或發佈文件夾運行,沒有任何反應。沒有錯誤,沒有窗口,沒有任何東西 - 據我所知,它沒有綁定在構建的應用程序中?
編輯:另外要添加,列仍然從ItemSource(使用數據上下文)加載其數據。編輯2:如果我將數據網格從用戶控件中移出並直接放入選項卡,它的行爲也是如此。所以我不認爲它與此有關。
編輯3:解決了評論 - 看起來像Costura在嵌入System.Windows.Interactivity失敗。
清潔soultion並再次建立 –
試過,以及關閉VS. – TyrantWave
你的調試文件夾中是否有System.window.Interactiv。 –