<Border Height="275" DockPanel.Dock="Top" BorderBrush="#FF959595">
<Grid>
<Image Width="800" Height="275" Source="Resources\Background_Top.png" />
<ListBox Name="EntranceListBox" Margin="25,15" Style="{DynamicResource SimEnvListStyle}" ItemContainerStyle="{DynamicResource ListItemStyle}" BorderThickness="0" Background="{x:Null}">
<ListBox.Resources>
<Style x:Key="ListItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="UIElement.Focusable" Value="https://bbs.csdn.net/topics/False" />
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Button x:ConnectionId="2" Height="85" Width="85" Style="{DynamicResource EntranceButtonStyle}" Focusable="False" Cursor="Hand" Margin="{Binding Margin}" ToolTip="{Binding Name}">
<Image Height="80" VerticalAlignment="Center" RenderOptions.BitmapScalingMode="Fant" Source="{Binding Icon}" />
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Border>
編譯出錯:Error 1 The attribute 'ConnectionId' from the XAML namespace is not defined. 請問這個是什么問題?怎么解決,謝謝諸位。
uj5u.com熱心網友回復:
忘記說了,這段代碼是ILSpy反編譯出來的,一般的視窗只實作了IComponentConnector介面,但是在這個代碼中還實作了另一個介面IStyleConnector。[EditorBrowsable(EditorBrowsableState.Never), DebuggerNonUserCode]
void IStyleConnector.Connect(int connectionId, object target)
{
if (connectionId == 2)
{
((Button)target).Click += new RoutedEventHandler(this.EntranceButton_Click);
return;
}
switch (connectionId)
{
case 6:
((Button)target).Click += new RoutedEventHandler(this.OpenProjectFile_Click);
return;
case 7:
((Button)target).Click += new RoutedEventHandler(this.DeleteProjectFile_Click);
return;
default:
return;
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/48089.html
標籤:C#
下一篇:怎么用TF-IDF提取關鍵詞?
