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

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

@ -8,16 +8,10 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; 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 ICSharpCode.Core.Presentation;
using Microsoft.Win32;
namespace ICSharpCode.SharpDevelop.Gui namespace ICSharpCode.SharpDevelop.Gui
{ {
@ -27,28 +21,22 @@ namespace ICSharpCode.SharpDevelop.Gui
public partial class StringListEditorXaml : UserControl public partial class StringListEditorXaml : UserControl
{ {
bool browseForDirectory; bool browseForDirectory;
public event EventHandler ListChanged; public event EventHandler ListChanged;
public string TitleText { public StringListEditorXaml()
get { return this.title.Content.ToString(); }
set { this.title.Content = value;}
}
public string ListCaption
{ {
get {return this.listlabel.Content.ToString();} InitializeComponent();
set {this.listlabel.Content = value;} 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 AddButtonText {
get {return addButton.Content.ToString();}
set {addButton.Content = value;}
} }
public string TitleText {get;set;}
public string ListCaption {get;set;}
public bool BrowseForDirectory { public bool BrowseForDirectory {
get { get {
return browseForDirectory; return browseForDirectory;
@ -191,12 +179,6 @@ namespace ICSharpCode.SharpDevelop.Gui
#endregion #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
editor.BrowseForDirectory = true; editor.BrowseForDirectory = true;
editor.TitleText = StringParser.Parse("${res:Global.Folder}:"); 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.ListCaption = StringParser.Parse("${res:Dialog.ProjectOptions.ReferencePaths}:");
editor.ListChanged += delegate { IsDirty = true; }; editor.ListChanged += delegate { IsDirty = true; };
} }

Loading…
Cancel
Save