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

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

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

Loading…
Cancel
Save