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