public ExportWebMap()
        {
            InitializeComponent();

            printTask = new PrintTask("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task");
            printTask.DisableClientCaching     = true;
            printTask.ExecuteCompleted        += printTask_PrintCompleted;
            printTask.GetServiceInfoCompleted += printTask_GetServiceInfoCompleted;
            printTask.GetServiceInfoAsync();
        }
        public ExportWebMap()
        {
            InitializeComponent();

            printTask = new PrintTask("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task");
            printTask.DisableClientCaching = true;
            printTask.ExecuteCompleted += printTask_PrintCompleted;
            printTask.GetServiceInfoCompleted += printTask_GetServiceInfoCompleted;
            printTask.GetServiceInfoAsync();
        }
        protected override void OnDownloadConfigXMLCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string xmlConfig = e.Result;

            widgetConfig = (PrintWidgetConfig)PrintWidgetConfig.Deserialize(xmlConfig, typeof(PrintWidgetConfig));

            if (widgetConfig.ExportMapTaskUrl != "")
            {
                printTask = new PrintTask(widgetConfig.ExportMapTaskUrl);
                printTask.GetServiceInfoCompleted += new EventHandler <ServiceInfoEventArgs>(PrintTask_GetServiceInfoCompleted);
                printTask.GetServiceInfoAsync();
            }
            else
            {
                this.HeaderPanel.Children[0].Visibility = System.Windows.Visibility.Collapsed;
                this.PanelExportMap.Visibility          = System.Windows.Visibility.Collapsed;
                this.ToggleWidgetContent(1);
            }
        }
        private async void mapView_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                var info = await _printTask.GetServiceInfoAsync();

                comboLayout.ItemsSource = info.LayoutTemplates;
                if (info.LayoutTemplates != null && info.LayoutTemplates.Count > 0)
                {
                    comboLayout.SelectedIndex = 0;
                }

                comboFormat.ItemsSource = info.Formats;
                if (info.Formats != null && info.Formats.Count > 0)
                {
                    comboFormat.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Sample Error");
            }
        }