Browse Source

StringListEditorXaml.xaml - Databinding

pull/30/head
PeterForstmeier 13 years ago
parent
commit
a72eaa823a
  1. 105
      src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml
  2. 36
      src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml.cs
  3. 1
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ReferencePaths.xaml.cs

105
src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml

@ -7,80 +7,67 @@ @@ -7,80 +7,67 @@
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<Grid>
<Grid.RowDefinitions>
<RowDefinition
Height="30"></RowDefinition>
<RowDefinition
Height="30"></RowDefinition>
<RowDefinition
Height="30"></RowDefinition>
<RowDefinition
Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="150"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="300"></ColumnDefinition>
<ColumnDefinition
Width="40"></ColumnDefinition>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition Width="40"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label
x:Name="title"
Content="Title"></Label>
<TextBox
x:Name="editTextBox"
Margin="5,3,5,3"
TextChanged="EditTextBox_TextChanged"
Grid.Row="1"></TextBox>
<Button
x:Name="browseButton"
<Label Content="{Binding TitleText}"></Label>
<TextBox x:Name="editTextBox" Grid.Row="1" Margin="5,3,5,3"
TextChanged="EditTextBox_TextChanged">
</TextBox>
<Button x:Name="browseButton" Grid.Column="1" Grid.Row="1" Margin="0,3,5,0"
Content="..."
Visibility="Hidden"
Margin="0,3,5,0"
Grid.Column="1"
Grid.Row="1"
Click="BrowseButtonClick"
/>
<widgets:StackPanelWithSpacing
Orientation="Horizontal"
Margin="5,3,5,3"
SpaceBetweenItems="5"
Grid.Row="2">
<Button
x:Name="addButton"
IsEnabled="False"
Click="BrowseButtonClick">
</Button>
Click="AddButton_Click"
Content="{core:Localize Global.AddButtonText}"
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button>
<Button
x:Name="updateButton"
<widgets:StackPanelWithSpacing Orientation="Horizontal" Grid.Row="2" Margin="5,3,5,3" SpaceBetweenItems="5">
<Button x:Name="addButton"
IsEnabled="False"
Click="AddButton_Click"
Content="{core:Localize Dialog.ProjectOptions.ReferencePaths.AddPath}"
Style="{x:Static core:GlobalStyles.ButtonStyle}">
</Button>
<Button x:Name="updateButton"
IsEnabled="False"
Click="UpdateButton_Click"
Content="{core:Localize Global.UpdateButtonText}"
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button>
<Button
x:Name="removeButton"
Visibility="Hidden"
Style="{x:Static core:GlobalStyles.ButtonStyle}">
</Button>
<Button x:Name="removeButton"
Visibility="Hidden"
Content="{core:Localize Global.DeleteButtonText}"
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button>
Style="{x:Static core:GlobalStyles.ButtonStyle}">
</Button>
</widgets:StackPanelWithSpacing>
<Label
x:Name="listlabel"
Grid.Row="3"
Content="List"></Label>
<ListBox
x:Name="listBox"
Margin="5,3,5,3"
SelectionChanged="ListBox_SelectionChanged"
Grid.Row="4"></ListBox>
<widgets:StackPanelWithSpacing Orientation="Vertical" SpaceBetweenItems="5"
Grid.Row="4" Grid.Column="1">
<Button Content="b1" x:Name="moveUpButton" Click="MoveUpButtonClick"></Button>
<Button Content="b2" x:Name="moveDownButton" Click="MoveDownButtonClick"></Button>
<Button Content="b3" x:Name="deleteButton" Click="RemoveButtonClick"></Button>
<Label Grid.Row="3"
Content="{Binding ListCaption}">
</Label>
<ListBox x:Name="listBox" Grid.Row="4" Margin="5,3,5,3"
SelectionChanged="ListBox_SelectionChanged">
</ListBox>
<widgets:StackPanelWithSpacing Orientation="Vertical" Grid.Row="4" Grid.Column="1" SpaceBetweenItems="5">
<Button Content="b1" x:Name="moveUpButton" Click="MoveUpButtonClick"></Button>
<Button Content="b2" x:Name="moveDownButton" Click="MoveDownButtonClick"></Button>
<Button Content="b3" x:Name="deleteButton" Click="RemoveButtonClick"></Button>
</widgets:StackPanelWithSpacing>
</Grid>
</UserControl>

36
src/Main/Base/Project/Src/Gui/Components/StringListEditorXaml.xaml.cs

@ -8,16 +8,10 @@ @@ -8,16 +8,10 @@
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.Core.Presentation;
using Microsoft.Win32;
namespace ICSharpCode.SharpDevelop.Gui
{
@ -27,26 +21,20 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -27,26 +21,20 @@ namespace ICSharpCode.SharpDevelop.Gui
public partial class StringListEditorXaml : UserControl
{
bool browseForDirectory;
public event EventHandler ListChanged;
public string TitleText {
get { return this.title.Content.ToString(); }
set { this.title.Content = value;}
}
public string ListCaption
public StringListEditorXaml()
{
get {return this.listlabel.Content.ToString();}
set {this.listlabel.Content = value;}
InitializeComponent();
moveUpButton.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.ArrowUp") };
moveDownButton.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.ArrowDown")};
deleteButton.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.DeleteIcon")};
DataContext = this;
}
public string TitleText {get;set;}
public string AddButtonText {
get {return addButton.Content.ToString();}
set {addButton.Content = value;}
}
public string ListCaption {get;set;}
public bool BrowseForDirectory {
@ -191,12 +179,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -191,12 +179,6 @@ namespace ICSharpCode.SharpDevelop.Gui
#endregion
public StringListEditorXaml()
{
InitializeComponent();
moveUpButton.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.ArrowUp") };
moveDownButton.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.ArrowDown")};
deleteButton.Content = new Image { Height = 16, Source = PresentationResourceService.GetBitmapSource("Icons.16x16.DeleteIcon")};
}
}
}

1
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ReferencePaths.xaml.cs

@ -23,7 +23,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -23,7 +23,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
editor.BrowseForDirectory = true;
editor.TitleText = StringParser.Parse("${res:Global.Folder}:");
editor.AddButtonText = StringParser.Parse("${res:Dialog.ProjectOptions.ReferencePaths.AddPath}");
editor.ListCaption = StringParser.Parse("${res:Dialog.ProjectOptions.ReferencePaths}:");
editor.ListChanged += delegate { IsDirty = true; };
}

Loading…
Cancel
Save