<fw:NChildWindow x:Class="Com.FirmLib.UI.Insuer.WinInsuerInfo"
             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:fw="http://schemas.FWind/xaml"
             xmlns:wpf="clr-namespace:FWindSoft.Wpf;assembly=FWindSoft.Wpf"
             xmlns:uc="clr-namespace:Com.FirmLib.UI.Common"
             xmlns:bllCommon="clr-namespace:Com.FirmLib.UI.BllCommon"
             mc:Ignorable="d" Title="保险商信息"
             d:DesignHeight="300" d:DesignWidth="500" Name="this" Height="{Binding Height,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UIElement}}"
                 Width="{Binding ActualWidth,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ScrollContentPresenter}}" >
    <fw:NChildWindow.Resources>
        <wpf:BindingProxy x:Key="DATA" Data="{Binding}"></wpf:BindingProxy>
    </fw:NChildWindow.Resources>
    <fw:NChildWindow.AttachElement>
        <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal" VerticalAlignment="Center">
            <Button Command="{Binding Data.Commands.SaveCommand,Source={StaticResource ResourceKey=DATA}}" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  BorderThickness="0"  FontFamily="{DynamicResource ResourceKey={x:Static wpf:FontsUtil.AwesomeKey}}">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{wpf:FontIcon Icon=Save}"  Width="30" FontSize="20"></TextBlock>
                        <TextBlock Text="保存" VerticalAlignment="Center" Margin="-5,0,0,0"></TextBlock>
                    </StackPanel>
                </Button.Content>
            </Button>
        </StackPanel>
      
    </fw:NChildWindow.AttachElement>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical" 
                    VerticalAlignment="Center" HorizontalAlignment="Left" Width="200">
            <fw:TextBoxEditor  Text="{Binding Name,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"  VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="5"
                               Command="{x:Static bllCommon:EditCommands.SingleUpdate}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}" Tag="Name"></fw:TextBoxEditor>

            <fw:TextBoxEditor  Text="{Binding Url,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"  VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="5"
                               Command="{x:Static bllCommon:EditCommands.SingleUpdate}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}" Tag="Url" ></fw:TextBoxEditor>
           
        </StackPanel>

        <GroupBox Grid.Row="1" Grid.Column="0"  Margin="0,10,0,10" Header="厂家提供保险服务的所有项目"  Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.GroupBoxKey}}"  >

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition ></RowDefinition>
                </Grid.RowDefinitions>
                <StackPanel HorizontalAlignment="Right">
                    <Button Command="{Binding Commands.AddInsuracncePolicy}" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.ButtonKey}}"  Height="23" Margin="5" Content="新项目添加保单" />
                </StackPanel>
                <ListBox Grid.Row="1" ItemsSource="{Binding ProjectItems}" BorderThickness="0" Padding="-5,0,-5,0">
                    <ListBox.ItemsPanel >
                        <ItemsPanelTemplate>
                            <WrapPanel Orientation="Horizontal" Width="{Binding Path=Width,RelativeSource={RelativeSource AncestorType=ListBox}}"/>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                        <Border BorderThickness="1"  BorderBrush="Black" Margin="5" Padding="5" fw:MaskOptions.IsManualHide="true" fw:MaskOptions.IsShow="{Binding IsLoading}">
                                               <fw:MaskOptions.MaskTemplate>
                                            <ControlTemplate>
                                                <Border Background="Gray" Opacity="0.5">
                                                    <ProgressBar  VerticalAlignment="Center" Margin="5" IsIndeterminate="True"></ProgressBar>
                                                </Border>
                                            </ControlTemplate>
                                        </fw:MaskOptions.MaskTemplate>
                                            <Grid Width="150" Height="80" >
                                                <Grid.RowDefinitions>
                                                    <RowDefinition></RowDefinition>
                                                    <RowDefinition Height="Auto"></RowDefinition>
                                                </Grid.RowDefinitions>
                                                <StackPanel Orientation="Vertical" Grid.Row="0">
                                                    <Grid>
                                                         <TextBlock Margin="5,0,5,0" Name="TxtName" FontSize="20" Text="{Binding ProjectLocalName}"></TextBlock>
                                                         <Button  HorizontalAlignment="Right" VerticalAlignment="Center" Content="刷新" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.LinkButtonKey}}" Command="{Binding Data.Commands.RefreshCommand,Source={StaticResource ResourceKey=DATA}}" CommandParameter="{Binding}" ></Button>
                                                    </Grid>
                                                  
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBlock Margin="5,0,5,0"  Text="涉及的保单："  />
                                                        <TextBlock Margin="5,0,5,0" x:Name="TXTN" Text="{Binding InsurancePolicyCount}" TextDecorations="Underline"/>
                                                        <TextBlock Margin="5,0,5,0"  Text="个" />
                                                    </StackPanel>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBlock Margin="5,0,5,0"  Text="在保资产："  />
                                                        <TextBlock Margin="5,0,5,0"  Text="{Binding AssetCount}" TextDecorations="Underline"/>
                                                        <TextBlock Margin="5,0,5,0"  Text="个" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <Button Grid.Row="1" Grid.Column="0" x:Name="BTNU" HorizontalAlignment="Right" Content="进入项目" Style="{StaticResource ResourceKey={x:Static uc:CommonStyles.LinkButtonKey}}" Command="{Binding Data.Commands.GoToProject,Source={StaticResource ResourceKey=DATA}}" CommandParameter="{Binding}" ></Button>
                                            </Grid>
                                        </Border>

                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                </ListBox>
            </Grid>

        </GroupBox>
    </Grid>
</fw:NChildWindow>

