Newer
Older
Correlator / PipeGallery / View / SoundSpeedView.xaml
<UserControl x:Class="PipeGallery.View.SoundSpeedView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:converter="clr-namespace:PipeGallery.Converter"
             mc:Ignorable="d" 
             d:DesignHeight="768" d:DesignWidth="1366" Background="#224f86">
    <UserControl.Resources>
        <converter:ItemBackgroundConverter x:Key="itemBackgroundConverter"/>
    </UserControl.Resources>
    <Grid>
        <Viewbox>
            <Grid Width="1366" Height="768">
                <Grid Background="White" Margin="10,36,10,10">
                    <Grid.RowDefinitions>
                        <RowDefinition  Height="*"/>
                        <RowDefinition  Height="6*"/>
                    </Grid.RowDefinitions>
                    <Grid>
                        <StackPanel Orientation="Horizontal" Margin="20,0,0,0">
                            <Button x:Name="btnReturn" Margin="10,0,20,0" Style="{StaticResource BtnReturnStyle}" />
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition  Height="*"/>
                                    <RowDefinition  Height="0.9*"/>
                                </Grid.RowDefinitions>
                                <TextBlock  Text="自定义声速编辑"  Foreground="#6c6c6c" FontSize="24" VerticalAlignment="Bottom"/>
                                <TextBlock  Text="User - defined list of materials"  Grid.Row="1" Foreground="#cecece" FontSize="16" VerticalAlignment="Top"/>
                            </Grid>
                        </StackPanel>
                        <Button x:Name="btnDelete" Content="删除" Width="80" Margin="250,0" HorizontalAlignment="Right" Style="{StaticResource BtnCommonStyle}">
                            <Button.Background>
                                <ImageBrush ImageSource="/PipeGallery;component/Image/tubiao_46.png" />
                            </Button.Background>
                            <Button.Tag>
                                <ImageBrush ImageSource="/PipeGallery;component/Image/tubiao_17.png" />
                            </Button.Tag>
                        </Button>
                        <Button x:Name="btnNew" Content="新建" Width="80" Margin="150,0" HorizontalAlignment="Right" Style="{StaticResource BtnCommonStyle}">
                            <Button.Background>
                                <ImageBrush ImageSource="/PipeGallery;component/Image/tubiao_49.png" />
                            </Button.Background>
                            <Button.Tag>
                                <ImageBrush ImageSource="/PipeGallery;component/Image/tubiao_23.png" />
                            </Button.Tag>
                        </Button>
                        <Button x:Name="btnEdit" Content="编辑" Width="80" Margin="50,0" HorizontalAlignment="Right" Style="{StaticResource BtnCommonStyle}">
                            <Button.Background>
                                <ImageBrush ImageSource="/PipeGallery;component/Image/tubiao_47.png" />
                            </Button.Background>
                            <Button.Tag>
                                <ImageBrush ImageSource="/PipeGallery;component/Image/tubiao_19.png" />
                            </Button.Tag>
                        </Button>
                    </Grid>
                    <Grid Grid.Row="1">
                        <Border  Width="1145" BorderBrush="#d2d2d2" Margin="0,10,0,52" BorderThickness="1" CornerRadius="10">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="55"/>
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Border Background="#ebebeb" CornerRadius="10,10,0,0">
                                    <Grid >
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition  Width="*" />
                                            <ColumnDefinition  Width="*" />
                                            <ColumnDefinition  Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid>
                                            <TextBlock  Text="序号" FontSize="16"  Width="auto" Foreground="#545454" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </Grid>
                                        <Grid Grid.Column="1">
                                            <TextBlock  Text="最小直径(mm)" FontSize="16"  Width="auto" Foreground="#545454" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </Grid>
                                        <Grid Grid.Column="2">
                                            <TextBlock  Text="最大直径(mm)" FontSize="16"  Width="auto" Foreground="#545454" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </Grid>
                                        <Grid Grid.Column="3">
                                            <TextBlock  Text="声速(m/s)" FontSize="16"  Width="auto" Foreground="#545454" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </Grid>                              
                                    </Grid>
                                </Border>
                                <ListBox x:Name="lbx" Grid.Row="1" AlternationCount="2" ItemsSource="{Binding SoundSpeedInfos}" ItemContainerStyle="{StaticResource  ListBoxItemStyle}" Margin="0,5,0,0" ManipulationBoundaryFeedback="lbx_ManipulationBoundaryFeedback">                                 
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border x:Name="bdrMain"  Width="1145" Height="50"  BorderBrush="#d2d2d2" BorderThickness="0,0,0,1">
                                                <Border.Background>
                                                    <MultiBinding Converter="{StaticResource itemBackgroundConverter}" ConverterParameter="0">
                                                        <MultiBinding.Bindings>
                                                            <Binding  />
                                                            <Binding Path="ItemsSource" ElementName="lbx"/>
                                                        </MultiBinding.Bindings>
                                                    </MultiBinding>
                                                </Border.Background>
                                                <Grid>
                                                    <Grid>
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition  Width="*"/>
                                                            <ColumnDefinition  Width="*"/>
                                                            <ColumnDefinition  Width="*"/>
                                                            <ColumnDefinition  Width="*"/>
                                                        </Grid.ColumnDefinitions>
                                                        <Border x:Name="bdrBackground"  Grid.ColumnSpan="6" Visibility="Collapsed"  Background="#e7f0fb"/>
                                                        <Grid>
                                                            <TextBlock  Text="{Binding Order}"  FontSize="16"  Width="auto" Foreground="#545454" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                        </Grid>
                                                        <Grid Grid.Column="1">
                                                            <TextBlock  Text="{Binding MinRange}"  FontSize="16"  Width="auto" Foreground="#545454" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                        </Grid>
                                                        <Grid Grid.Column="2">
                                                            <TextBlock Text="{Binding MaxRange}" FontSize="16"  Width="auto" Foreground="#545454" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                        </Grid>
                                                        <Grid Grid.Column="3">
                                                            <TextBlock  Text="{Binding Speed}" FontSize="16"  Width="auto" Foreground="#545454" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                        </Grid>
                                                        <RadioButton x:Name="rb" IsChecked="{Binding IsSelected}"  Grid.ColumnSpan="4" Style="{StaticResource RadioButtonStyle4}"  GroupName="speed" Margin="0,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                                                    </Grid>
                                                </Grid>
                                            </Border>
                                            <DataTemplate.Triggers>
                                                <Trigger  SourceName="rb" Property="IsChecked" Value="true">
                                                    <Setter TargetName="bdrBackground"  Property="Visibility" Value="Visible"/>
                                                </Trigger>
                                            </DataTemplate.Triggers>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                    <ListBox.Template>
                                        <ControlTemplate TargetType="{x:Type ListBox}">
                                            <Grid  Background="Transparent" VerticalAlignment="Top" >
                                                <ScrollViewer HorizontalScrollBarVisibility="Hidden">
                                                    <StackPanel IsItemsHost="True"/>
                                                </ScrollViewer>
                                            </Grid>
                                        </ControlTemplate>
                                    </ListBox.Template>
                                </ListBox>
                            </Grid>
                        </Border>
                    </Grid>
                </Grid>
            </Grid>
        </Viewbox>
    </Grid>
</UserControl>