<!--MapPrinter Dialog Panel-->
<userControls:CollapsiblePanel x:Name="MapPrinterDialogPanel" Width="340" Height="405"
HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,60,10,0" Effect="{StaticResource dropShadow}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Background="{StaticResource CommonPanelBorderBackgroundBrush}" Effect="{StaticResource miniDropShadow}" >
<TextBlock Foreground="White" FontSize="12"
Text="Page Style : " TextWrapping="NoWrap" VerticalAlignment="Center" />
<ComboBox Name="comboPrintStyle" SelectionChanged="comboPrintStyle_SelectionChanged" Margin="5,2" MinWidth="80" SelectedIndex="0" VerticalAlignment="Center">
<ComboBox.Items>
<sys:String>(Default)</sys:String>
<sys:String>Basic</sys:String>
<sys:String>WithOverview</sys:String>
<sys:String>WithClonedMapAsOverview</sys:String>
<sys:String>WithLegend</sys:String>
</ComboBox.Items>
</ComboBox>
</StackPanel>
<printing:MapPrinterDialog x:Name="MapPrinterDialog" Background="{StaticResource CommonPanelBorderBackgroundBrush}" BorderBrush="{StaticResource CommonBorderBrush}" Grid.Row="1">
<printing:MapPrinter x:Name="mapPrinterWithDialog" Map="{Binding ElementName=Map}" Title="Map Title"
IsScaleFixed="True" Scale="2000000" />
</printing:MapPrinterDialog>
</Grid>
</userControls:CollapsiblePanel>
<userControls:WindowPanel x:Name="MapPrinterDialogPanel" Width="340" Height="405"
IsOpen="{Binding ElementName=btnToggleMapPrinterDialogPanel, Path=IsChecked, Mode=TwoWay}"
HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,60,10,0">
The only problem I'm having is my printing dialog isn't refreshing when my map extent changes
it did not apply to a button...just a togglebutton I think.
<ToggleButton x:Name="btnToggleMapPrinterDialogPanel" IsChecked="True" ToolTipService.ToolTip="Print Dialog"> <ToggleButton.Content> <Image Source="/MapPrintingControls;component/Images/i_print.png" Stretch="Fill" /> </ToggleButton.Content> </ToggleButton>
<!--MapPrinter Dialog Panel-->
<userControls:CollapsiblePanel x:Name="MapPrinterDialogPanel" Width="340" Height="405"
IsExpanded="{Binding ElementName=btnToggleMapPrinterDialogPanel, Path=IsChecked, Mode=TwoWay}"
HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,60,10,0" Effect="{StaticResource dropShadow}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Background="{StaticResource CommonPanelBorderBackgroundBrush}" Effect="{StaticResource miniDropShadow}" >
<TextBlock Foreground="White" FontSize="12"
Text="Page Style : " TextWrapping="NoWrap" VerticalAlignment="Center" />
<ComboBox Name="comboPrintStyle" SelectionChanged="comboPrintStyle_SelectionChanged" Margin="5,2" MinWidth="80" SelectedIndex="0" VerticalAlignment="Center">
<ComboBox.Items>
<sys:String>(Default)</sys:String>
<sys:String>Basic</sys:String>
<sys:String>WithOverview</sys:String>
<sys:String>WithClonedMapAsOverview</sys:String>
<sys:String>WithLegend</sys:String>
</ComboBox.Items>
</ComboBox>
</StackPanel>
<printing:MapPrinterDialog x:Name="MapPrinterDialog" Background="{StaticResource CommonPanelBorderBackgroundBrush}" BorderBrush="{StaticResource CommonBorderBrush}" Grid.Row="1">
<printing:MapPrinter x:Name="mapPrinterWithDialog" Map="{Binding ElementName=Map}" Title="Map Title"
IsScaleFixed="True" Scale="2000000" IsActive="{Binding ElementName=btnToggleMapPrinterDialogPanel, Path=IsChecked }"/>/>
</printing:MapPrinterDialog>
</Grid>
</userControls:CollapsiblePanel>
<!--END MapPrinter Dialog Panel-->
So since I'm trying to use a collapisble panel instead of userControls:WindowPanel that you created I'm having to change IsOpen to something and I was trying IsExpanded. The code complies and everything seems good but the toggle button is not closing and opening the print dialog.
IsOpen="{Binding ElementName=btnToggleMapPrinterDialogPanel, Path=IsChecked, Mode=TwoWay}"
IsExpanded="{Binding ElementName=btnToggleMapPrinterDialogPanel, Path=IsChecked, Mode=TwoWay}"
Thanks again for all the time and help. I really appreciate.
Nathalie.
<Grid.Resources>
<esri:MarkerSymbol x:Name="CustomSymbol1">
<esri:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Border Child="{Binding Attributes[MyTextBlock]}"/>
</ControlTemplate>
</esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>
</Grid.Resources>private static Layer CloneLayer(Layer layer) { ....... var graphicCollection = new GraphicCollection(); foreach (var graphic in fromLayer.Graphics) { var clone = new Graphic(); foreach (var kvp in graphic.Attributes) { clone.Attributes.Add(kvp); } ...........This one should clone the UIElements:
private static Layer CloneLayer(Layer layer) { ....... var graphicCollection = new GraphicCollection(); foreach (var graphic in fromLayer.Graphics) { var clone = new Graphic(); foreach (var kvp in graphic.Attributes) { if (kvp.Value is DependencyObject) { // If the attribute is a dependency object --> clone it var clonedkvp = new KeyValuePair<string, object>(kvp.Key, (kvp.Value as DependencyObject).Clone()); clone.Attributes.Add(clonedkvp); } else clone.Attributes.Add(kvp); }........