summaryrefslogtreecommitdiff
path: root/Noddybox.WindowsPhone.Silverlight/SaveDialog.xaml.cs
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2012-06-27 17:22:49 +0000
committerIan C <ianc@noddybox.co.uk>2012-06-27 17:22:49 +0000
commit1c036de8e527038f00b7ff07fc1ef4b80f23a846 (patch)
tree386aaa9c1d07f708c53bf05874f848a6a2e194c6 /Noddybox.WindowsPhone.Silverlight/SaveDialog.xaml.cs
parentaba818f3b66751842f457169ff1cfa58fc43dd84 (diff)
Started trying to add dependency objects. Don't work yet.
Diffstat (limited to 'Noddybox.WindowsPhone.Silverlight/SaveDialog.xaml.cs')
-rw-r--r--Noddybox.WindowsPhone.Silverlight/SaveDialog.xaml.cs97
1 files changed, 97 insertions, 0 deletions
diff --git a/Noddybox.WindowsPhone.Silverlight/SaveDialog.xaml.cs b/Noddybox.WindowsPhone.Silverlight/SaveDialog.xaml.cs
index f807126..8df7b73 100644
--- a/Noddybox.WindowsPhone.Silverlight/SaveDialog.xaml.cs
+++ b/Noddybox.WindowsPhone.Silverlight/SaveDialog.xaml.cs
@@ -26,14 +26,111 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
+using Noddybox.WindowsPhone.Silverlight.ViewModels;
+using System.ComponentModel;
namespace Noddybox.WindowsPhone.Silverlight
{
+ /// <summary>
+ /// Provides the save dialog user control.
+ /// </summary>
public partial class SaveDialog : UserControl
{
+ #region Private data
+
+ private FileDialogViewModel model;
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Construct a save dialog.
+ /// </summary>
public SaveDialog()
{
InitializeComponent();
+
+ if (!DesignerProperties.IsInDesignTool)
+ {
+ model = new FileDialogViewModel("/");
+ DataContext = model;
+ }
+ }
+
+ #endregion
+
+ #region Properties
+
+ public static readonly DependencyProperty StartPathProperty =
+ DependencyProperty.Register("StartPath", typeof(string), typeof(SaveDialog), null);
+ // new PropertyMetadata("StartPath", new PropertyChangedCallback(SaveDialog.OnStartPathChanged)));
+
+ public static readonly DependencyProperty OkButtonTextProperty =
+ DependencyProperty.Register("OkButtonText", typeof(string), typeof(SaveDialog), null);
+ // new PropertyMetadata("StartPath", new PropertyChangedCallback(SaveDialog.OnStartPathChanged)));
+
+ private static void OnStartPathChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Set the start path
+ /// </summary>
+ public string StartPath
+ {
+ set
+ {
+ if (!DesignerProperties.IsInDesignTool)
+ {
+ model.Path = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Set the contents of the OK button.
+ /// </summary>
+ public string OkButtonText
+ {
+ set
+ {
+ }
}
+
+ /// <summary>
+ /// Set the contents of the Cancel button.
+ /// </summary>
+ public string CancelButtonText
+ {
+ set {cancelButton.Content = value;}
+ }
+
+ #endregion
+
+ #region Event handlers
+
+ private void OnFilenameKeyUp(object sender, KeyEventArgs e)
+ {
+ model.Filename = fileName.Text;
+ }
+
+ private void OnOKButton(object sender, RoutedEventArgs e)
+ {
+ }
+
+ private void OnCancelButton(object sender, RoutedEventArgs e)
+ {
+ }
+
+ private void OnFileListSelection(object sender, SelectionChangedEventArgs e)
+ {
+ if (e.AddedItems.Count > 0)
+ {
+ model.FileSelected((FileInfo)e.AddedItems[0]);
+ }
+ }
+
+ #endregion
}
}