SystemCogView 代码备份

<UserControl x:Class="ShinePhoto.Views.SystemCogView"
             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:cal="http://www.caliburnproject.org"
             xmlns:vms="clr-namespace:ShinePhoto.ViewModels"
             d:DataContext="{d:DesignInstance vms:SystemCogViewModel, IsDesignTimeCreatable=True}"
             cal:Bind.AtDesignTime="True"
             mc:Ignorable="d" Width="800" Height="600"
             d:DesignHeight="300" d:DesignWidth="300">
    <Border BorderBrush="#2D91CF" BorderThickness="3" CornerRadius="4">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="30"></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Border Background="#2D91CF" CornerRadius="2,2,0,0">
                <Grid Background="Transparent" x:Name="TitleGrid" cal:Message.Attach="[Event MouseDown] = [Action MoveWindow($source, $eventargs, $view)]">
                    <TextBlock Margin="10,0,0,0" HorizontalAlignment="Left" Foreground="White" FontSize="16" VerticalAlignment="Center" x:Name="WindowTitle" />
                    <Button Content="X" FontSize="16" x:Name="CloseButton" cal:Message.Attach="[Event Click] = [Action CloseWindow($view)]" Foreground="White" Style="{DynamicResource myBtnStyle}" HorizontalAlignment="Right" Margin="0,0,5,0" Height="20" Width="20" />
                </Grid>
            </Border>
            <Grid Grid.Row="1" Background="White">
                <TabControl Template="{DynamicResource OfficeTabControl}" Name="tabSteps">
                    <TabItem Header="基本设置" IsSelected="True">
                        <StackPanel Margin="5">
                            <ToggleButton Style="{DynamicResource MetroToggleButtonStyle}" Content="123" />
                        </StackPanel>
                    </TabItem>
                    <TabItem Header="用户设置">
                        <TextBlock>Recent content tab</TextBlock>
                    </TabItem>
                    <TabItem Header="备份设置">
                        <TextBlock>New content tab</TextBlock>
                    </TabItem>
                    <TabItem Header="打印设置">
                                    
                    </TabItem>
                    <TabItem Header="待定功能">
                        <TextBlock>Save &amp; send content tab</TextBlock>
                    </TabItem>
                    <TabItem>
                        <TabItem.Header>
                            <StackPanel Orientation="Horizontal">
                                <Image VerticalAlignment="Center" Tag="0" Width="32" Height="32" Source="pack://application:,,,/ShinePhoto.Icons;Component/light/appbar.tree.leaf.png" />
                                <TextBlock Margin="5, 0, 0, 0" TextBlock.FontFamily="{StaticResource WenQuan}" VerticalAlignment="Center" Text="关于我们" />
                            </StackPanel>
                        </TabItem.Header>
                        <TextBlock>Info content</TextBlock>
                    </TabItem>
                </TabControl>
                            
                <!--<TabControl>
                    <TabItem Header="123" Tag="888">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.2*" />
                                <ColumnDefinition Width="0.8*" />
                            </Grid.ColumnDefinitions>
                            <ListBox x:Name="CategoryItems" >
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <VirtualizingStackPanel />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Foreground="Red" Text="{Binding}" />
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Grid>
                    </TabItem>
                </TabControl>-->
                            
            </Grid>
        </Grid>
    </Border>
                
</UserControl>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using ShinePhoto.Interface;
using Caliburn.Micro;
using System.Windows;
using System.Windows.Input;
namespace ShinePhoto.ViewModels
{
    [Export(typeof(SystemCogViewModel))]
    public class SystemCogViewModel : Screen
    {
        //private BindableCollection<string> _categoryItems;
        //public BindableCollection<string> CategoryItems {
        //    get {
        //        return _categoryItems;
        //    }
        //    set {
        //        _categoryItems = value;
        //        NotifyOfPropertyChange(() => CategoryItems);
        //    }
        //}
        public BindableCollection<string> CategoryItems { get; private set; }
        public SystemCogViewModel()
        {
            if (Execute.InDesignMode)
                LoadDesignData();
                
        }
        private void LoadDesignData()
        {
            System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback((state) =>
            {
                CategoryItems = new BindableCollection<string>();
                var arr = Enumerable.Range(1, 5).ToArray();
                for (int i = 0; i < arr.Length; i++)
                {
                    CategoryItems.Add(arr[i].ToString());
                }
            }));
        }
        #region 标题栏操作
        public void MoveWindow(object sender, MouseButtonEventArgs e, object view)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                (view as Window).DragMove();
            }
        }
        public void CloseWindow(object view)
        {
            if ((view as Window) != null)
            {
                (view as Window).Close();
            }
        }
        #endregion
        #region Properties
        private string _title = "程序设置";
        public string WindowTitle
        {
            get { return _title; }
            set
            {
                _title = value;
                NotifyOfPropertyChange(() => WindowTitle);
            }
        }
        #endregion
    }
}


知识共享许可协议
《SystemCogView 代码备份》常伟华 创作。
采用 知识共享 署名-相同方式共享 3.0 中国大陆 许可协议进行许可。
  • 多说评论
  • 签名
  • 新浪微博
  • 默认评论
  • Tab Header 5

0 条评论 / 点击此处发表评论

Tab Content 5

开发技术


开发平台和工具

sitemap     150.78ms