|
@@ -7,6 +7,7 @@ using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
|
using InABox.Core;
|
|
|
using InABox.Wpf;
|
|
|
+using InABox.Wpf.Editors;
|
|
|
using InABox.WPF;
|
|
|
using Microsoft.Win32;
|
|
|
|
|
@@ -51,10 +52,11 @@ namespace InABox.DynamicGrid
|
|
|
HorizontalAlignment = HorizontalAlignment.Stretch
|
|
|
};
|
|
|
//Grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(25, GridUnitType.Pixel) });
|
|
|
- Grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
|
- Grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50, GridUnitType.Pixel) });
|
|
|
- Grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50, GridUnitType.Pixel) });
|
|
|
- Grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50, GridUnitType.Pixel) });
|
|
|
+ Grid.AddColumn(GridUnitType.Star);
|
|
|
+ Grid.AddColumn(50);
|
|
|
+ Grid.AddColumn(50);
|
|
|
+ Grid.AddColumn(50);
|
|
|
+ Grid.AddColumn(60);
|
|
|
|
|
|
Editor = new TextBox
|
|
|
{
|
|
@@ -65,9 +67,7 @@ namespace InABox.DynamicGrid
|
|
|
IsEnabled = false
|
|
|
};
|
|
|
//Editor.LostFocus += (o, e) => CheckChanged();
|
|
|
- Editor.SetValue(Grid.ColumnProperty, 0);
|
|
|
- Editor.SetValue(Grid.RowProperty, 0);
|
|
|
- Grid.Children.Add(Editor);
|
|
|
+ Grid.AddChild(Editor, 0, 0);
|
|
|
|
|
|
var Select = new Button
|
|
|
{
|
|
@@ -78,10 +78,8 @@ namespace InABox.DynamicGrid
|
|
|
Content = "Select",
|
|
|
Focusable = false
|
|
|
};
|
|
|
- Select.SetValue(Grid.ColumnProperty, 1);
|
|
|
- Select.SetValue(Grid.RowProperty, 0);
|
|
|
Select.Click += Select_Click;
|
|
|
- Grid.Children.Add(Select);
|
|
|
+ Grid.AddChild(Select, 0, 1);
|
|
|
|
|
|
var Clear = new Button
|
|
|
{
|
|
@@ -92,10 +90,8 @@ namespace InABox.DynamicGrid
|
|
|
Content = "Clear",
|
|
|
Focusable = false
|
|
|
};
|
|
|
- Clear.SetValue(Grid.ColumnProperty, 2);
|
|
|
- Clear.SetValue(Grid.RowProperty, 0);
|
|
|
Clear.Click += Clear_Click;
|
|
|
- Grid.Children.Add(Clear);
|
|
|
+ Grid.AddChild(Clear, 0, 2);
|
|
|
|
|
|
var View = new Button
|
|
|
{
|
|
@@ -106,14 +102,35 @@ namespace InABox.DynamicGrid
|
|
|
Content = "View",
|
|
|
Focusable = false
|
|
|
};
|
|
|
- View.SetValue(Grid.ColumnProperty, 3);
|
|
|
- View.SetValue(Grid.RowProperty, 0);
|
|
|
View.Click += View_Click;
|
|
|
- Grid.Children.Add(View);
|
|
|
+ Grid.AddChild(View, 0, 3);
|
|
|
+
|
|
|
+ var rename = new Button
|
|
|
+ {
|
|
|
+ VerticalAlignment = VerticalAlignment.Stretch,
|
|
|
+ VerticalContentAlignment = VerticalAlignment.Center,
|
|
|
+ HorizontalAlignment = HorizontalAlignment.Stretch,
|
|
|
+ Margin = new Thickness(5, 1, 0, 1),
|
|
|
+ Content = "Rename",
|
|
|
+ Focusable = false
|
|
|
+ };
|
|
|
+ rename.Click += Rename_Click;
|
|
|
+ Grid.AddChild(rename, 0, 4);
|
|
|
|
|
|
return Grid;
|
|
|
}
|
|
|
|
|
|
+ private void Rename_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ var name = _document.FileName;
|
|
|
+ if(TextEdit.Execute("Enter filename:", ref name))
|
|
|
+ {
|
|
|
+ _document.FileName = name;
|
|
|
+ Editor.Text = _document.FileName;
|
|
|
+ Host.SaveDocument(_document);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void Select_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
var dlg = new OpenFileDialog();
|