Browse Source

Flat Collection Editor Refresh fix (hacky)

pull/58/head
jkuehner 12 years ago
parent
commit
0029ec5d39
  1. 91
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml
  2. 7
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml.cs

91
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml

@ -1,30 +1,85 @@ @@ -1,30 +1,85 @@
<Window x:Class="ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FlatCollectionEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:OutlineView="clr-namespace:ICSharpCode.WpfDesign.Designer.OutlineView"
xmlns:PropertyGrid="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid"
Height="438" Width="750" Title="Edit Items" WindowStartupLocation="CenterScreen">
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FlatCollectionEditor" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:OutlineView="clr-namespace:ICSharpCode.WpfDesign.Designer.OutlineView" xmlns:PropertyGrid="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid"
Height="438"
Width="750"
Title="Edit Items"
WindowStartupLocation="CenterScreen" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="4*" />
<ColumnDefinition
Width="3*" />
<ColumnDefinition
Width="100" />
<ColumnDefinition
Width="4*" />
</Grid.ColumnDefinitions>
<Border BorderBrush="Black" BorderThickness="0.75" Margin="10" SnapsToDevicePixels="True">
<ListBox x:Name="ListBox" SelectionChanged="ListBox_SelectionChanged">
<Border
BorderBrush="Black"
BorderThickness="0.75"
Margin="10"
SnapsToDevicePixels="True">
<ListBox
x:Name="ListBox"
SelectionChanged="ListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ComponentType.Name}" />
<TextBlock
Text="{Binding ComponentType.Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<Button Content="Add" Click="OnAddItemClicked" Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="0,12,0,0" Name="AddItem" VerticalAlignment="Top" Width="75" />
<Button Content="Remove" Click="OnRemoveItemClicked" Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="0,42,0,0" Name="RemoveItem" VerticalAlignment="Top" Width="75" />
<Button Content="Move Up" Click="OnMoveItemUpClicked" Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="0,72,0,0" Name="MoveUpItem" VerticalAlignment="Top" Width="75" />
<Button Content="Move Down" Click="OnMoveItemDownClicked" Grid.Column="1" Height="23" HorizontalAlignment="Left" Margin="0,102,0,0" Name="MoveDownItem" VerticalAlignment="Top" Width="75" />
<Border BorderBrush="Black" BorderThickness="0.75" Margin="10" Grid.Column="2" SnapsToDevicePixels="True">
<PropertyGrid:PropertyGridView x:Name="PropertyGridView" Margin="0.5" />
<Button
Content="Add"
Click="OnAddItemClicked"
Grid.Column="1"
Height="23"
HorizontalAlignment="Left"
Margin="0,12,0,0"
Name="AddItem"
VerticalAlignment="Top"
Width="75" />
<Button
Content="Remove"
Click="OnRemoveItemClicked"
Grid.Column="1"
Height="23"
HorizontalAlignment="Left"
Margin="0,42,0,0"
Name="RemoveItem"
VerticalAlignment="Top"
Width="75" />
<Button
Content="Move Up"
Click="OnMoveItemUpClicked"
Grid.Column="1"
Height="23"
HorizontalAlignment="Left"
Margin="0,72,0,0"
Name="MoveUpItem"
VerticalAlignment="Top"
Width="75" />
<Button
Content="Move Down"
Click="OnMoveItemDownClicked"
Grid.Column="1"
Height="23"
HorizontalAlignment="Left"
Margin="0,102,0,0"
Name="MoveDownItem"
VerticalAlignment="Top"
Width="75" />
<Border
BorderBrush="Black"
BorderThickness="0.75"
Margin="10"
Grid.Column="2"
SnapsToDevicePixels="True">
<PropertyGrid:PropertyGridView
x:Name="PropertyGridView"
Margin="0.5" />
</Border>
</Grid>
</Window>

7
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Text;
using System.Windows;
@ -77,9 +78,9 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors @@ -77,9 +78,9 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors
void refreshList()
{
ListBox.ItemsSource = null;
ListBox.ItemsSource = _itemProperty.CollectionElements;
ListBox.Items.Refresh();
var sel = ListBox.SelectedItem;
ListBox.ItemsSource = new ObservableCollection<DesignItem>(_itemProperty.CollectionElements);
ListBox.SelectedItem = sel;
}
private void OnMoveItemUpClicked(object sender, RoutedEventArgs e)

Loading…
Cancel
Save