Hello Dominique,I'm trying to change the layout of the printing page with a ComboBox:<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Text="Tipo de folha:" Margin="5,0,5,0" VerticalAlignment="Center"></TextBlock>
<ComboBox x:Name="cbxPaperType" Width="110" Height="25" VerticalAlignment="Center">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
Command="{Binding PaperTypeCommand}"
CommandParameter="{Binding ElementName=cbxPaperType}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ComboBox.Items>
<ComboBoxItem IsSelected="True">A4</ComboBoxItem>
<ComboBoxItem>A3, A2, A1, A0</ComboBoxItem>
</ComboBox.Items>
</ComboBox>
</StackPanel>
Using the following command method to change:private void PaperType(object param)
{
if (param == null)
{
return;
}
ComboBox cbx = param as ComboBox;
ResourceDictionary dict = new ResourceDictionary();
Uri uri = new Uri("/MapPrintingControls;component/MapPrinter.xaml", UriKind.Relative);
dict.Source = uri;
if (cbx.SelectedIndex == 0)
{
ControlTemplate ct = (ControlTemplate)dict["MapPrinter_A4"];
Template = ct;
printMap.Width = 771;
printMap.Height = 1122;
Width = 793;
Height = 1122;
UpdateLayout();
}
}
It changes the template correctly but I can't move the map. Looks like it is losing an event handler.Can you help me?Thanks a lot.