65 lines
2.2 KiB
C#
65 lines
2.2 KiB
C#
using Microsoft.Win32;
|
|
using OliviaAddInPro.Helper;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using Xceed.Wpf.Toolkit.PropertyGrid;
|
|
using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
|
|
using static OliviaAddInPro.Helper.HelperGdb;
|
|
|
|
namespace OliviaAddInPro.View.Configuracion
|
|
{
|
|
/// <summary>
|
|
/// Lógica de interacción para PropertyGridFilePicker.xaml
|
|
/// </summary>
|
|
public partial class PropertyGridFilePickerFolder : ITypeEditor
|
|
{
|
|
public PropertyGridFilePickerFolder()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public string Value
|
|
{
|
|
get { return (string)GetValue(ValueProperty); }
|
|
set { SetValue(ValueProperty, value); }
|
|
}
|
|
|
|
// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
|
|
public static readonly DependencyProperty ValueProperty =
|
|
DependencyProperty.Register("Value", typeof(string), typeof(PropertyGridFilePickerFolder), new PropertyMetadata(null));
|
|
|
|
|
|
|
|
public FrameworkElement ResolveEditor(PropertyItem propertyItem)
|
|
{
|
|
Binding binding = new Binding("Value");
|
|
binding.Source = propertyItem;
|
|
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
|
|
BindingOperations.SetBinding(this, ValueProperty, binding);
|
|
return this;
|
|
}
|
|
|
|
private void PickFileButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
OpenFileDialog fd = new OpenFileDialog();
|
|
//var st = HelperGdb.SaveFileDlg("Seleccione carpeta", null, null, ArcGIS.Desktop.Catalog.ItemFilters.Folders);
|
|
var st = HelperGdb.FolderBrowseDlg("Seleccione carpeta", null);
|
|
if (!string.IsNullOrEmpty(st))
|
|
{
|
|
Value = st;
|
|
}
|
|
}
|
|
}
|
|
}
|