You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
256 lines
14 KiB
256 lines
14 KiB
<!--***********************************************************************************
|
|
|
|
Extended WPF Toolkit
|
|
|
|
Copyright (C) 2007-2013 Xceed Software Inc.
|
|
|
|
This program is provided to you under the terms of the Microsoft Public
|
|
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
|
|
|
For more features, controls, and fast professional support,
|
|
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
|
|
|
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
|
|
|
**********************************************************************************-->
|
|
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit"
|
|
xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"
|
|
xmlns:colconv="clr-namespace:Xceed.Wpf.Toolkit.Converters"
|
|
xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes"
|
|
xmlns:pg="clr-namespace:Xceed.Wpf.Toolkit.PropertyGrid">
|
|
|
|
<conv:InverseBoolConverter x:Key="InverseBoolConverter" />
|
|
<conv:ObjectTypeToNameConverter x:Key="ObjectTypeToNameConverter" />
|
|
<colconv:NewItemTypesComboBoxConverter x:Key="NewItemTypesComboBoxConverter" />
|
|
|
|
<Style x:Key="CollectionControlButtonStyle" TargetType="{x:Type Button}">
|
|
<Style.Triggers>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Opacity" Value="0.6" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="Height" Value="26" />
|
|
<Setter Property="Width" Value="26" />
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type local:CollectionControl}">
|
|
<Style.Resources>
|
|
<Style TargetType="ListBox">
|
|
<Setter Property="ItemTemplate">
|
|
<Setter.Value>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Converter={StaticResource ObjectTypeToNameConverter}}"/>
|
|
</DataTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</Style.Resources>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type local:CollectionControl}">
|
|
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="1.5*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition />
|
|
</Grid.RowDefinitions>
|
|
<TextBlock Margin="0,0,0,5" Text="Select type:" />
|
|
<ComboBox x:Name="PART_NewItemTypesComboBox"
|
|
Grid.Row="1"
|
|
Margin="0,0,0,3"
|
|
HorizontalAlignment="Stretch"
|
|
DisplayMemberPath="Name">
|
|
<ComboBox.ItemsSource>
|
|
<MultiBinding Converter="{StaticResource NewItemTypesComboBoxConverter}">
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ItemsSourceType" />
|
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="NewItemTypes" />
|
|
</MultiBinding>
|
|
</ComboBox.ItemsSource>
|
|
</ComboBox>
|
|
<Button Margin="3,0,0,3"
|
|
Grid.Row="1"
|
|
Grid.Column="1"
|
|
Padding="5,0"
|
|
Content="Add"
|
|
Command="New"
|
|
CommandParameter="{Binding SelectedItem, ElementName=PART_NewItemTypesComboBox}" />
|
|
<ListBox x:Name="_itemsListBox"
|
|
Grid.Row="2"
|
|
Grid.ColumnSpan="2"
|
|
ItemsSource="{Binding Items, RelativeSource={RelativeSource TemplatedParent}}"
|
|
SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource TemplatedParent}}"
|
|
SelectedIndex="0">
|
|
</ListBox>
|
|
<StackPanel Margin="7,2,0,0" VerticalAlignment="Top" Grid.Column="2" Grid.Row="2">
|
|
<Button Style="{StaticResource CollectionControlButtonStyle}"
|
|
Command="ComponentCommands.MoveUp"
|
|
CommandParameter="{Binding SelectedItem, ElementName=_itemsListBox}">
|
|
<Path Fill="#FF404040" Data="F0 M 6,0 L 12,7 8,7 8,12 4,12 4,7 0,7 Z" />
|
|
</Button>
|
|
<Button Margin="0,1,0,0"
|
|
Style="{StaticResource CollectionControlButtonStyle}"
|
|
Command="ComponentCommands.MoveDown"
|
|
CommandParameter="{Binding SelectedItem, ElementName=_itemsListBox}">
|
|
<Path Fill="#FF404040" Data="F0 M 4,0 L 8,0 8,5 12,5 6,12 0,5 4,5 Z" />
|
|
</Button>
|
|
<Button Margin="0,7,0,0"
|
|
Style="{StaticResource CollectionControlButtonStyle}"
|
|
Command="Delete"
|
|
CommandParameter="{Binding SelectedItem, ElementName=_itemsListBox}">
|
|
<Image Stretch="None" Height="16" Width="16" Margin="1" Source="./../Images/Delete16.png" />
|
|
</Button>
|
|
</StackPanel>
|
|
</Grid>
|
|
<Grid Column="1" Margin="20,0,0,0">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition />
|
|
</Grid.RowDefinitions>
|
|
<TextBlock Grid.Column="1" Text="Properties:" />
|
|
<pg:PropertyGrid Grid.Row="1"
|
|
Grid.Column="1"
|
|
Margin="0,5,0,0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
SelectedObject="{Binding SelectedItem, RelativeSource={RelativeSource TemplatedParent}}"
|
|
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="PrimitiveTypeCollectionControl" TargetType="{x:Type local:PrimitiveTypeCollectionControl}">
|
|
<Setter Property="BorderBrush">
|
|
<Setter.Value>
|
|
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
|
<GradientStop Color="#FFA3AEB9" Offset="0" />
|
|
<GradientStop Color="#FF8399A9" Offset="0.375" />
|
|
<GradientStop Color="#FF718597" Offset="0.375" />
|
|
<GradientStop Color="#FF617584" Offset="1" />
|
|
</LinearGradientBrush>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderThickness" Value="1,1,0,1" />
|
|
<Setter Property="Focusable" Value="False" />
|
|
<Setter Property="Padding" Value="2,0,0,0" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type local:PrimitiveTypeCollectionControl}">
|
|
<local:MultiLineTextEditor Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
Content="{TemplateBinding Content}"
|
|
Padding="{TemplateBinding Padding}"
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
IsOpen="{TemplateBinding IsOpen}"
|
|
IsReadOnly="{TemplateBinding IsReadOnly}"
|
|
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}"
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type local:PrimitiveTypeCollectionControl}" BasedOn="{StaticResource PrimitiveTypeCollectionControl}" />
|
|
|
|
<Style x:Key="CollectionControlButton"
|
|
TargetType="{x:Type local:CollectionControlButton}">
|
|
<Setter Property="Background"
|
|
Value="White" />
|
|
<Setter Property="BorderThickness"
|
|
Value="0" />
|
|
<Setter Property="Padding"
|
|
Value="2,0,0,0" />
|
|
<Setter Property="HorizontalContentAlignment"
|
|
Value="Left" />
|
|
<Setter Property="VerticalContentAlignment"
|
|
Value="Center" />
|
|
<Setter Property="Content"
|
|
Value="(Collection)" />
|
|
<Setter Property="SnapsToDevicePixels"
|
|
Value="True" />
|
|
<Setter Property="MinHeight"
|
|
Value="22" />
|
|
<Setter Property="IsTabStop"
|
|
Value="True" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Grid SnapsToDevicePixels="True">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Border Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
Padding="{TemplateBinding Padding}"
|
|
SnapsToDevicePixels="True">
|
|
<ContentPresenter Content="{TemplateBinding Content}"
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
|
</Border>
|
|
|
|
<chrome:ButtonChrome x:Name="ToggleButtonChrome"
|
|
Grid.Column="1"
|
|
CornerRadius="0,2.75,2.75,0"
|
|
RenderEnabled="{Binding IsEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CollectionControlButton}}"
|
|
RenderMouseOver="{TemplateBinding IsMouseOver}">
|
|
<Grid x:Name="arrowGlyph"
|
|
IsHitTestVisible="False"
|
|
Grid.Column="1"
|
|
Margin="5">
|
|
<Path x:Name="Arrow"
|
|
Width="7"
|
|
Height="4"
|
|
Data="M 0,1 C0,1 0,0 0,0 0,0 3,0 3,0 3,0 3,1 3,1 3,1 4,1 4,1 4,1 4,0 4,0 4,0 7,0 7,0 7,0 7,1 7,1 7,1 6,1 6,1 6,1 6,2 6,2 6,2 5,2 5,2 5,2 5,3 5,3 5,3 4,3 4,3 4,3 4,4 4,4 4,4 3,4 3,4 3,4 3,3 3,3 3,3 2,3 2,3 2,3 2,2 2,2 2,2 1,2 1,2 1,2 1,1 1,1 1,1 0,1 0,1 z"
|
|
Fill="#FF000000" />
|
|
</Grid>
|
|
</chrome:ButtonChrome>
|
|
</Grid>
|
|
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled"
|
|
Value="False">
|
|
<Setter Property="Fill"
|
|
TargetName="Arrow"
|
|
Value="#AFAFAF" />
|
|
<Setter Property="Foreground"
|
|
Value="Gray" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type local:CollectionControlButton}"
|
|
BasedOn="{StaticResource CollectionControlButton}" />
|
|
|
|
</ResourceDictionary>
|
|
|