Browse Source

添加面包屑

ltwork 1 year ago
parent
commit
02ee362f5c

+ 20 - 0
BlankApp1/BlankApp1/Models/CrumbViewModel.cs

@@ -0,0 +1,20 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PLCTool.Models
+{
+    public class CrumbViewModel : BindableBase
+    {
+        private string _name;
+        public string Name
+        {
+            get { return _name; }
+            set { SetProperty(ref _name, value); }
+        }
+    }
+
+}

+ 30 - 1
BlankApp1/BlankApp1/ViewModels/BasicConfigViewModel/ProjectViewModel.cs

@@ -5,6 +5,7 @@ using MiniExcelLibs;
 using Model.Dto;
 using Model.Entities;
 using PLCTool.Common;
+using PLCTool.Models;
 using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Services.Dialogs;
@@ -38,9 +39,23 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
             EditCommand = new DelegateCommand<object>(Edit);
             DeleteCommand = new DelegateCommand<object>(Delete);
             ResetCommand = new DelegateCommand<object>(Reset);
+            BreadChangedCommand = new DelegateCommand<object>(BreadChangedC);
+            Path.Add(new CrumbViewModel { Name = "基础设置" });
+            Path.Add(new CrumbViewModel { Name = "项目管理" });
+
             GetPprojectConfig();
         }
 
+        private void BreadChangedC(object obj)
+        {
+            switch(SelectedCrumb.Name)
+            {
+                case "基础设置": break;
+                case "项目管理": break;
+
+            }
+        }
+
 
 
 
@@ -290,11 +305,25 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
         /// </summary>
         public DelegateCommand<Object> EditCommand { set; get; }
         public DelegateCommand<object> ResetCommand { set; get; }
+        public DelegateCommand<object> BreadChangedCommand { set; get; }
+        
         #endregion
 
         #region 数据绑定
 
-
+        private ObservableCollection<CrumbViewModel> _path=new ObservableCollection<CrumbViewModel>();
+        public ObservableCollection<CrumbViewModel> Path
+        {
+            get { return _path; }
+            set { SetProperty(ref _path, value); }
+        }
+        private CrumbViewModel selectedCrumb = new CrumbViewModel();
+        public CrumbViewModel SelectedCrumb
+        {
+            get { return selectedCrumb; }
+            set { SetProperty(ref selectedCrumb, value); }
+        }
+        
         /// <summary>
         /// 开始时间
         /// </summary>

+ 21 - 8
BlankApp1/BlankApp1/Views/BasicConfigView/ProjectView.xaml

@@ -7,17 +7,30 @@
              xmlns:hc="https://handyorg.github.io/handycontrol"
              xmlns:myContr="clr-namespace:BlankApp1.Controls"
              xmlns:wpfdev="https://github.com/WPFDevelopersOrg/WPFDevelopers"
+               xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
+
     <Grid >
         <Grid.RowDefinitions>
+            <RowDefinition Height="30"/>
             <RowDefinition Height="40"/>
             <RowDefinition Height="40"/>
             <RowDefinition/>
             <RowDefinition Height="40"/>
 
         </Grid.RowDefinitions>
-        <UniformGrid Grid.Row="0" Columns="3">
+        <Grid Grid.Row="0" Background=" #F2F2F2">
+            <wpfdev:BreadCrumbBar ItemsSource="{Binding Path}" VerticalAlignment="Center"  DisplayMemberPath="Name" Margin="0,0"
+                                SelectedItem="{Binding SelectedCrumb, Mode=TwoWay}">
+                <b:Interaction.Triggers>
+                    <b:EventTrigger EventName="SelectionChanged">
+                        <b:InvokeCommandAction Command="{Binding BreadChangedCommand}"/>
+                    </b:EventTrigger>
+                </b:Interaction.Triggers>
+            </wpfdev:BreadCrumbBar>
+        </Grid>
+        <UniformGrid Grid.Row="1" Columns="3">
             <StackPanel Orientation="Horizontal">
                 <TextBlock Text="项目编号:"  Style="{StaticResource NormalTextBlockStyle}" Margin="10,0,5,0"/>
                 <TextBox  Height="28" Width="120" Text="{Binding ProjectNo}" />
@@ -34,7 +47,7 @@
 
 
         </UniformGrid>
-        <Grid Grid.Row="1">
+        <Grid Grid.Row="2">
             <Grid.ColumnDefinitions>
                 <ColumnDefinition/>
                 <ColumnDefinition/>
@@ -49,16 +62,16 @@
                     <hc:DateTimePicker ShowClearButton="True" Style="{StaticResource DateTimePickerExtend}" Height="25" Width="160"  Text="{Binding EndTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                 </StackPanel>
             </StackPanel>
-            <StackPanel Grid.Column="1" Orientation="Horizontal">
+            <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
 
                 <Button  Content="查询" Width="80"  Margin="5,0"  Command="{Binding QueryCommand}" Style="{StaticResource NormalButtonStyle}" />
-                <Button  Content="重置" Width="80"  Margin="5,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" />
-                <Button  Content="新增" Width="80"  Margin="5,0"  Command="{Binding AddCommand}" Style="{StaticResource NormalButtonStyle}"/>
+                <Button  Content="重置" Width="80"  Margin="5,0"  Command="{Binding ResetCommand}" Style="{StaticResource NormalButtonStyle}" Background=" #7F7F7F" />
+                <Button  Content="新增" Width="80"  Margin="5,0"  Command="{Binding AddCommand}" Style="{StaticResource NormalButtonStyle}" Background="#00BFBF"/>
 
-                <Button Content="导出Excel" Width="80"  Margin="5,0"  Command="{Binding ExportCommand}" Style="{StaticResource NormalButtonStyle}" />
+                <!--<Button Content="导出Excel" Width="80"  Margin="5,0"  Command="{Binding ExportCommand}" Style="{StaticResource NormalButtonStyle}" />-->
             </StackPanel>
         </Grid>
-        <DataGrid  Grid.Row="2"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0"
+        <DataGrid  Grid.Row="3"  ColumnWidth="*" AutoGenerateColumns="False" HeadersVisibility="All" CanUserAddRows="False"  SelectionUnit="FullRow" SelectionMode="Single"   RowHeaderWidth="0"
                   ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"  RowHeaderStyle="{StaticResource RowHeaderStyle}" RowStyle="{StaticResource DataGridRowtyle}"  AlternationCount="2"
                  ItemsSource="{Binding ProjectItemList}" IsReadOnly="True" Padding="0"  >
             <DataGrid.Columns >
@@ -96,7 +109,7 @@
             </DataGrid.Columns>
 
         </DataGrid>
-        <Grid Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center">
+        <Grid Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center">
             <wpfdev:Pagination IsLite="False"    Margin="0"  Width="auto" Height="30" HorizontalAlignment="Center"  
                        Count="{Binding TotalCount,Mode=TwoWay}" 
                        CountPerPage="{Binding CountPerPage,Mode=TwoWay}"