暂存修改

croire 3 years ago
parent 9ef5354e73
commit 2c11e4243e

@ -1,9 +1,8 @@
using Prism.Events; using DownKyi.ViewModels.PageViewModels;
using System; using Prism.Commands;
using System.Collections.Generic; using Prism.Events;
using System.Linq; using Prism.Regions;
using System.Text; using System.Collections.ObjectModel;
using System.Threading.Tasks;
namespace DownKyi.ViewModels.Friend namespace DownKyi.ViewModels.Friend
{ {
@ -11,8 +10,78 @@ namespace DownKyi.ViewModels.Friend
{ {
public const string Tag = "PageFriendFollower"; public const string Tag = "PageFriendFollower";
#region 页面属性申明
private ObservableCollection<TabHeader> tabHeaders;
public ObservableCollection<TabHeader> TabHeaders
{
get => tabHeaders;
set => SetProperty(ref tabHeaders, value);
}
private int selectTabId;
public int SelectTabId
{
get => selectTabId;
set => SetProperty(ref selectTabId, value);
}
#endregion
public ViewFollowerViewModel(IEventAggregator eventAggregator) : base(eventAggregator) public ViewFollowerViewModel(IEventAggregator eventAggregator) : base(eventAggregator)
{ {
#region 属性初始化
TabHeaders = new ObservableCollection<TabHeader>();
int i = TabHeaders.Count;
#endregion
}
#region 命令申明
// 左侧tab点击事件
private DelegateCommand<object> leftTabHeadersCommand;
public DelegateCommand<object> LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand<object>(ExecuteLeftTabHeadersCommand));
/// <summary>
/// 左侧tab点击事件
/// </summary>
/// <param name="parameter"></param>
private void ExecuteLeftTabHeadersCommand(object parameter)
{
if (!(parameter is TabHeader tabHeader)) { return; }
//NavigationParameters param = new NavigationParameters();
//switch (tabHeader.Id)
//{
// case 0:
// regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, param);
// break;
// case 1:
// regionManager.RequestNavigate("ToolboxContentRegion", ViewDelogoViewModel.Tag, param);
// break;
// case 2:
// regionManager.RequestNavigate("ToolboxContentRegion", ViewExtractMediaViewModel.Tag, param);
// break;
//}
}
#endregion
/// <summary>
/// 导航到页面时执行
/// </summary>
/// <param name="navigationContext"></param>
public override void OnNavigatedTo(NavigationContext navigationContext)
{
base.OnNavigatedTo(navigationContext);
// 进入设置页面时显示的设置项
SelectTabId = 0;
} }
} }
} }

@ -2,13 +2,57 @@
x:Class="DownKyi.Views.Friend.ViewFollower" x:Class="DownKyi.Views.Friend.ViewFollower"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:DownKyi.Converter"
xmlns:custom="clr-namespace:DownKyi.CustomControl" xmlns:custom="clr-namespace:DownKyi.CustomControl"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/" xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"> prism:ViewModelLocator.AutoWireViewModel="True">
<UserControl.Resources /> <UserControl.Resources>
<converter:CountConverter x:Key="CountConverter" Count="1" />
</UserControl.Resources>
<Grid> <Grid>
<TextBlock Text="关注" /> <Grid.ColumnDefinitions>
<ColumnDefinition>
<ColumnDefinition.Style>
<Style TargetType="ColumnDefinition">
<Style.Triggers>
<DataTrigger Binding="{Binding TabHeaders}" Value="{x:Null}">
<Setter Property="Width" Value="0" />
</DataTrigger>
<DataTrigger Binding="{Binding TabHeaders.Count}" Value="0">
<Setter Property="Width" Value="0" />
</DataTrigger>
<DataTrigger Binding="{Binding TabHeaders.Count}" Value="1">
<Setter Property="Width" Value="0" />
</DataTrigger>
<DataTrigger Binding="{Binding TabHeaders.Count, Converter={StaticResource CountConverter}}" Value="true">
<Setter Property="Width" Value="200" />
</DataTrigger>
</Style.Triggers>
</Style>
</ColumnDefinition.Style>
</ColumnDefinition>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 左侧tab header -->
<ListBox
Name="nameLeftTabHeaders"
Grid.Column="0"
BorderThickness="0"
ItemContainerStyle="{StaticResource LeftTabHeaderItemStyle}"
ItemsSource="{Binding TabHeaders}"
SelectedIndex="{Binding SelectTabId}"
Style="{StaticResource LeftTabHeaderStyle}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding LeftTabHeadersCommand}" CommandParameter="{Binding ElementName=nameLeftTabHeaders, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
<!-- 右侧内容区 -->
<ListBox Grid.Column="1" />
</Grid> </Grid>
</UserControl> </UserControl>

@ -51,7 +51,6 @@
Name="nameTabHeaders" Name="nameTabHeaders"
Grid.Column="1" Grid.Column="1"
BorderThickness="0" BorderThickness="0"
IsEnabled="{Binding IsEnabled}"
ItemsSource="{Binding TabHeaders}" ItemsSource="{Binding TabHeaders}"
ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"

Loading…
Cancel
Save