1
好的,我修改了选项卡控件模板,添加了两个按钮,一个打开,另一个与其他选项卡一起保存。WPF OnMouse Up from Template
我需要做的是让按钮在窗口内部运行OpenSave/CloseSave函数。每个窗口都有自己的打开和保存功能,因为它们会有所不同,这就是为什么我需要它使用窗口内的功能。
<Style x:Key="EditorTabControl" TargetType="{x:Type TabControl}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid SnapsToDevicePixels="True">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="0" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Border Grid.Row="2" Panel.ZIndex="1" Background="#fafafa" Padding="10" BorderBrush="#ededed" BorderThickness="0 1 0 0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="Open" Style="{StaticResource EditorButtonStyle}"/>
<Button Content="Save" Style="{StaticResource EditorButtonStyle}"/>
<TabPanel IsItemsHost="True"/>
</StackPanel>
</Border>
<Border Grid.Row="0" BorderThickness="0" BorderBrush="#696969" Background="#FFF">
<ContentPresenter Content="{TemplateBinding SelectedContent}" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
那么我将如何能够使控制模板运行在它使用的窗口中的函数?
你的问题是......? – David 2013-03-21 17:45:58
那么我怎样才能使控制模板运行在它使用的窗口中的函数呢? – 2013-03-21 17:47:37
绑定到'ICommand'不行吗? – 2013-03-21 20:24:08