简体   繁体   English

MahApps.Metro MetroTabControl和Caliburn

[英]MahApps.Metro MetroTabControl with Caliburn

i try to raise the TabItemClosingEvent of the Controls:MetroTabControl. 我尝试引发Controls:MetroTabControl的TabItemClosingEvent。

XAML: XAML:

<Controls:MetroTabControl cal:Message.Attach="[Event TabItemClosingEvent] = [Action CloseConnection($source, $eventArgs)];" DockPanel.Dock="Top" Background="{x:Null}" ItemsSource="{Binding Connections.View}" SelectedItem="{Binding SelectedConnection}"  Margin="10,0">

Code: 码:

public void CloseConnection(object sender, BaseMetroTabControl.TabItemClosingEventArgs e)
{
e.Cancel = false;
}

CloseConnection is never called. 永远不会调用CloseConnection。 Somebody can see my fault? 有人可以看到我的错吗?

Thank you 谢谢

I wasn't able to make MahApps work with Caliburn's short syntax either. 我也无法使MahApps使用Caliburn的短语法。

However, the long syntax works for me: 但是,长语法适用于我:

<Controls:MetroTabControl DockPanel.Dock="Top" 
                            Background="{x:Null}"
                            ItemsSource="{Binding Connections.View}" 
                            SelectedItem="{Binding SelectedConnection}"  Margin="10,0" >
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="TabItemClosingEvent">
            <cal:ActionMessage MethodName="CloseConnection">
                <cal:Parameter Value="$source" />
                <cal:Parameter Value="$eventArgs" />
            </cal:ActionMessage>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</Controls:MetroTabControl>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM