O365(世纪互联葡京在线开户)SharePoint 之站点天性化

前言

[索引页]
[源码下载]

  上一篇小说中,我们简要介绍了何等使用O36第55中学SharePoint
Online文书档案库,SharePoint
Online的长处就是提必要我们广大非常便宜开箱即用的功效,让大家快捷的搭建站点,方便的利用和保卫安全大家的内容,用最少的费用工作量落成站点建设。

从长计议Silverlight(47) – 4.0UI之操作剪切板, 隐式样式,
CompositeTransform, 拖放外部文件到程序中

  本文,大家简要介绍一下SharePoint
Online中如何转移外观,个性化站点等。

作者:webabcd

  ① 、我们能够见到SharePoint
Online首页的默许样式,其实过多事物大家都以能够充足便利进行天性化的,包含:

介绍
Silverlight 4.0 用户界面(UI)相关:

Ø
站点图标(Part 1)

  • 操作剪切板 – 帮忙获取或安装剪切板中的文本音信 
  • 隐式样式(Implicit Style)
    – 将某种样式应用到某种类型的有所因素,即全局样式 
  • CompositeTransform – 将多种转移格局合二为一 
  • 拖动(Drag)外部文件,并将其放置(Drop) Silverlight 程序中

Ø
左边导航(Part 2)

在线DEMO
http://www.cnblogs.com/webabcd/archive/2010/08/09/1795417.html

Ø
顶部导航(Part 3)

示例
① 、演示怎样操作剪切板
Clipboard.xaml

Ø
页面名称(Part 4)

葡京在线开户 1葡京在线开户 2代码

Ø 站点外观

<navigation:Page x:Class=”Silverlight40.UI.Clipboard” 
           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
           Title=”Clipboard Page”>
    <Grid x:Name=”LayoutRoot”>
        <StackPanel HorizontalAlignment=”Left”>
            
            <TextBox Name=”txtMsg” Width=”200″ Height=”50″ Margin=”5″ />

葡京在线开户 3

            <!– 复制 txtMsg 中的文本 –>
            <Button Name=”btnCopy” Content=”复制” Margin=”5″ Click=”btnCopy_Click” />

  贰 、点击右上角小齿轮展开菜单,点击“网站设置”进入站点设置页面;

            <!– 将剪切板中的文本粘贴到 txtMsg –>
            <Button Name=”btnPaste” Content=”粘贴” Margin=”5″ Click=”btnPaste_Click” />

葡京在线开户 4

        </StackPanel>
    </Grid>
</navigation:Page>

  ③ 、私下认可包罗站点标题、站点说明、站点图标表达,大家得以在页面上便宜的改动站点的如下属性;

Clipboard.xaml.cs

葡京在线开户 5

葡京在线开户 6葡京在线开户 7代码

  肆 、大家输入完成属性,然后点击右下角的规定按钮保存属性;

/*
 * Silverlight 4.0 辅助对剪切板的拜访,只协助获取或设置剪切板中的文本消息
 *     System.Windows.Clipboard.SetText(string s) – 将点名的字符串复制到剪切板
 *     System.Windows.Clipboard.GetText() – 获取剪切板中的文本新闻
 *     
 * 只有在 Click 或 KeyDown 事件的处理程序中才能够访问剪切板
 * 访问剪切板时,Silverlight 会弹出对话框供给用户举办确认,假如用户禁止了,则会抓住那些。要是程序是“被信任的应用程序”则不会弹出该对话框
 */

葡京在线开户 8

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;

  ⑤ 、然后我们看一下SharePoint
Online中的导航设置,同样是在网站设置里面;我们首先看一下导航成分那么些设置,如下图:

namespace Silverlight40.UI
{
    public partial class Clipboard : Page
    {
        public Clipboard()
        {
            InitializeComponent();
        }

葡京在线开户 9

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {

  ⑥ 、大家得以依照必要启用快快捷运输营恐怕树视图,两者的切切实实分化能够参照描述;笔者明白快捷运维便是右边导航,树视图正是网站组织;

        }

葡京在线开户 10

        private void btnCopy_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                System.Windows.Clipboard.SetText(txtMsg.Text);
            }
            catch (System.Security.SecurityException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

  七 、然后进入网站设置 –
导航;常常大家不开启树视图,那些是力不从心设置的;而快捷启动约等于左手导航,是能够在导航里增加和删除改查的;

        private void btnPaste_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                txtMsg.SelectedText = System.Windows.Clipboard.GetText();
            }
            catch (System.Security.SecurityException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

葡京在线开户 11

二 、演示 Silverlight 4.0 对隐式样式(全局样式)的支撑
ImplicitStyle.xaml

  捌 、能够看来导航包罗全局导航和当前导航,大家一般采取结构导航,至于托管导航,大家会在现在的小说中持有介绍;

葡京在线开户 12葡京在线开户 13代码

  导航的安装能够回顾该站点的子站点恐怕页面,我们得以勾选是还是不是包蕴;

<navigation:Page x:Class=”Silverlight40.UI.ImplicitStyle” 
           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
           Title=”ImplicitStyle Page”>
    <Grid x:Name=”LayoutRoot”>

葡京在线开户 14

        <!–
            隐式样式(Implicit Style) – 将某种样式应用到某种类型的拥有因素,即全局样式
        –>
        <ToggleButton Width=”200″ Height=”50″ Content=”用于演示隐式样式(Implicit Style)。ToggleButton 的体制设置详细 Assets/ToggleButtonStyle.xaml” />
        
    </Grid>
</navigation:Page>

  ⑨ 、我们可以一本万利的安装导航排序和增加修改导航;

App.xaml

葡京在线开户 15

葡京在线开户 16葡京在线开户 17代码

  ⑩ 、导航链接除了主导的标题、链接、表达属性,还有一个非凡有效的品质叫做访问群体,大家能够在做客群众体育里添加全局访问群众体育、AD通信组或然安全组、SharePoint用户组来限制用户是不是能够观察该链接;

<Application   
  x:Class=”Silverlight40.App”
  xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation
  xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml"&gt;

葡京在线开户 18

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source=”Assets/ToggleButtonStyle.xaml”/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

  1① 、选取访问群众体育,能够通过寻找的艺术开始展览搜寻;

</Application>

葡京在线开户 19

ToggleButtonStyle.xaml

  1② 、添加实现的结构导航,如下图:

葡京在线开户 20葡京在线开户 21代码

葡京在线开户 22

<ResourceDictionary
  xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
  xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml
  xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”>

  1三 、回到大家站点的首页,能够观察站点图标、左边导航、顶部导航都早已修改了,而且,大家也能看到步骤10中添加标题和添加链接的区分;

    <!– ToggleButton 的隐式样式(Implicit Style) –>
    <Style TargetType=”ToggleButton”>
        <Setter Property=”Background” Value=”#FF1F3B53″/>
        <Setter Property=”Foreground” Value=”#FF000000″/>
        <Setter Property=”Padding” Value=”3″/>
        <Setter Property=”BorderThickness” Value=”1″/>
        <Setter Property=”BorderBrush”>
            <Setter.Value>
                <LinearGradientBrush EndPoint=”0.5,1″ StartPoint=”0.5,0″>
                    <GradientStop Color=”#FFA3AEB9″ Offset=”0″/>
                    <GradientStop Color=”#FF8399A9″ Offset=”0.375″/>
                    <GradientStop Color=”#FF718597″ Offset=”0.375″/>
                    <GradientStop Color=”#FF617584″ Offset=”1″/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property=”Template”>
            <Setter.Value>
                <ControlTemplate TargetType=”ToggleButton”>
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name=”CommonStates”>
                                <VisualState x:Name=”Normal”/>
                                <VisualState x:Name=”MouseOver”>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=”(UIElement.Opacity)” Storyboard.TargetName=”Background”>
                                            <EasingDoubleKeyFrame KeyTime=”0″ Value=”1″/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name=”Pressed”>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty=”(Border.Background).(SolidColorBrush.Color)” Storyboard.TargetName=”Background”>
                                            <SplineColorKeyFrame KeyTime=”0″ Value=”#FFffe575″/>
                                        </ColorAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=”(UIElement.Opacity)” Storyboard.TargetName=”Background”>
                                            <EasingDoubleKeyFrame KeyTime=”0″ Value=”1″/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=”(UIElement.Opacity)” Storyboard.TargetName=”grid”>
                                            <EasingDoubleKeyFrame KeyTime=”0″ Value=”0″/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty=”(Border.BorderBrush).(SolidColorBrush.Color)” Storyboard.TargetName=”Background”>
                                            <EasingColorKeyFrame KeyTime=”0″ Value=”#FFC28A30″/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name=”Disabled”>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=”Opacity” Storyboard.TargetName=”DisabledVisualElement”>
                                            <SplineDoubleKeyFrame KeyTime=”0″ Value=”.55″/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name=”CheckStates”>
                                <VisualState x:Name=”Checked”>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty=”(Border.Background).(SolidColorBrush.Color)” Storyboard.TargetName=”Background2″>
                                            <SplineColorKeyFrame KeyTime=”0″ Value=”#FFffe575″/>
                                        </ColorAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=”(UIElement.Opacity)” Storyboard.TargetName=”Background2″>
                                            <EasingDoubleKeyFrame KeyTime=”0″ Value=”1″/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=”(UIElement.Opacity)” Storyboard.TargetName=”grid2″>
                                            <EasingDoubleKeyFrame KeyTime=”0″ Value=”0″/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty=”(Border.BorderBrush).(SolidColorBrush.Color)” Storyboard.TargetName=”Background2″>
                                            <EasingColorKeyFrame KeyTime=”0″ Value=”#FFC28A30″/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name=”Unchecked”/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name=”FocusStates”>
                                <VisualState x:Name=”Focused”>
                                </VisualState>
                                <VisualState x:Name=”Unfocused”/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name=”Background” BorderThickness=”{TemplateBinding BorderThickness}” Background=”#FFFDF7E2″ CornerRadius=”3″ BorderBrush=”#FFF0C958″ Opacity=”0″>
                            <Grid x:Name=”grid” Margin=”1″>
                                <Grid.Background>
                                    <LinearGradientBrush EndPoint=”0.5,1″ StartPoint=”0.5,0″>
                                        <GradientStop Color=”#FFFDF7E2″ Offset=”1″/>
                                        <GradientStop Color=”#FFFCEDB3″/>
                                    </LinearGradientBrush>
                                </Grid.Background>
                            </Grid>
                        </Border>
                        <Border x:Name=”Background2″ BorderThickness=”{TemplateBinding BorderThickness}” Background=”#FFFDF7E2″ CornerRadius=”3″ BorderBrush=”#FFF0C958″ Opacity=”0″>
                            <Grid x:Name=”grid2″ Margin=”1″>
                                <Grid.Background>
                                    <LinearGradientBrush EndPoint=”0.5,1″ StartPoint=”0.5,0″>
                                        <GradientStop Color=”#FFFDF7E2″ Offset=”1″/>
                                        <GradientStop Color=”#FFFCEDB3″/>
                                    </LinearGradientBrush>
                                </Grid.Background>
                            </Grid>
                        </Border>
                        <ContentPresenter x:Name=”contentPresenter” ContentTemplate=”{TemplateBinding ContentTemplate}” Content=”{TemplateBinding Content}” HorizontalAlignment=”{TemplateBinding HorizontalContentAlignment}” Margin=”{TemplateBinding Padding}” VerticalAlignment=”{TemplateBinding VerticalContentAlignment}”/>
                        <Rectangle x:Name=”DisabledVisualElement” Fill=”#FFFFFFFF” IsHitTestVisible=”false” Opacity=”0″ RadiusY=”3″ RadiusX=”3″/>
                        <Rectangle x:Name=”FocusVisualElement” IsHitTestVisible=”false” Margin=”1″ Opacity=”0″ RadiusY=”2″ RadiusX=”2″ Stroke=”#FF6DBDD1″ StrokeThickness=”1″/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>

葡京在线开户 23

3、演示 CompositeTransform 的效果
CompositeTransform.xaml

  1四 、上面,我们尝试修改一下网站的外观,同样是在网站设置,找到外观 –
更改外观;

葡京在线开户 24葡京在线开户 25代码

葡京在线开户 26

<navigation:Page x:Class=”Silverlight40.UI.CompositeTransform” 
           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
           Title=”CompositeTransform Page”>
    <Grid x:Name=”LayoutRoot”>
        <StackPanel HorizontalAlignment=”Left” Margin=”100,0,0,0″>
            
            <!–
                CompositeTransform – 将三种更换格局融为一体
                    CenterX – 转换大旨点的 X 坐标
                    CenterY – 转换中央点的 Y 坐标
                    Rotation – 顺时针旋转角度
                    ScaleX – 沿 X 轴方向上的缩放比例
                    ScaleY – 沿 Y 轴方向上的缩放比例
                    SkewX – X 轴扭曲角度
                    SkewY – Y 轴扭曲角度
                    TranslateX – 沿 X 轴方向上的运动距离
                    TranslateY – 沿 Y 轴方向上的移位距离
            –>
            <Rectangle Height=”100″ Width=”100″ Fill=”Red”>
                <Rectangle.RenderTransform>
                    <CompositeTransform SkewX=”30″ Rotation=”60″ ScaleX=”0.6″ ScaleY=”0.3″ />
                </Rectangle.RenderTransform>
            </Rectangle>

  1五 、选用2个你欣赏的,点击图片即可;

            <!– 用 TransformGroup 的形式实现地点的 CompositeTransform 的如出一辙成效 –>
            <Rectangle Height=”100″ Width=”100″ Fill=”Red”>
                <Rectangle.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX=”0.6″ ScaleY=”0.3″ />
                        <SkewTransform AngleX=”30″ />
                        <RotateTransform Angle=”60″ />
                    </TransformGroup>
                </Rectangle.RenderTransform>
            </Rectangle>

葡京在线开户 27

        </StackPanel>
    </Grid>
</navigation:Page>

  1⑥ 、能够点击试用,当然也得以修改颜色、字体、网站布局等;

四 、演示如何 Drag&Drop 外部文件到 Silverlight 程序中
DragAndDrop.xaml

葡京在线开户 28

葡京在线开户 29葡京在线开户 30代码

  1⑦ 、试用效果如下图,假如认为不错,能够点击保存,不然不太喜欢即可;

<navigation:Page x:Class=”Silverlight40.UI.DragAndDrop” 
           xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 
           xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” 
           xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
           xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
           xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
           Title=”DragAndDrop Page”>
    <Grid x:Name=”LayoutRoot”>
        <StackPanel HorizontalAlignment=”Left”>

  小编那莲灰背景的Logo真是不协调,真应该修改完外观再改Logo的,^_^;

            <!– 对 Silverlight 中的 UIElement 进行拖动的 德姆o 详见那里 –>
            <HyperlinkButton NavigateUri=”http://www.cnblogs.com/webabcd/archive/2008/11/13/1332450.html” TargetName=”_blank” Content=”在 Silverlight 中拖放 UIElement 的 Demo” />

葡京在线开户 31

            <!– 这是 DropTarget –>
            <ListBox Name=”listBox” Background=”LightBlue” Height=”400″>
                <ListBoxItem Content=”拖动外部文件到那里,以查看演示效果” />
            </ListBox>

  18、再修改贰遍Logo,看看我们经过一些大概本性化后的站点,是或不是有一小点内网的趣味了啊?!O(∩_∩)O~

        </StackPanel>
    </Grid>
</navigation:Page>

葡京在线开户 32

DragAndDrop.xaml.cs

总结

葡京在线开户 33葡京在线开户 34代码

  Sharepoint
Online的有点在于急忙,而且数量不会丢掉,不须求维护服务器;当然sharepoint只是O365的三个小部分,结合Exchange
Online发送邮件,Lync Online在线聊天依然蛮不错的。

/*
 * 拖放操作的 德姆o – Silverlight 4.0 支持拖动外部文件到 Silverlight 程序中(协理多文本拖放,可是不协理文件夹拖放)
 * 
 * UIElement.AllowDrop – 钦定 UIElement 是还是不是足以用作于 DropTarget(拖放操作的放目的)。私下认可值为 false
 * UIElement.DragEnter – 拖动外部文件进入到 UIElement 时所接触的事件(事件参数类型为:Drag伊芙ntArgs)
 * UIElement.DragLeave – 拖动外部文件离开 UIElement 时所接触的风云(事件参数类型为:Drag伊夫ntArgs)
 * UIElement.DragOver – 拖动外部文件在 UIElement 中活动时所接触的轩然大波(事件参数类型为:Drag伊夫ntArgs)
 * UIElement.Drop – 拖动外部文件在 UIElement 中放大时所接触的风云(事件参数类型为:Drag伊夫ntArgs)
 * Drag伊夫ntArgs – 拖放操作所接触的拖放事件的轩然大波参数
 *     Drag伊夫ntArgs.Data – 获取与拖放事件相关联的数量(IDataObject 类型)
 * IDataObject.GetData(DataFormats.FileDrop) – 再次回到被拖放的外表文件的 FileInfo 数组
 */

  同时,大家在网站设置用或然会看不到“导航”、“外观”等选取,记得开启网站集功用的“SharePoint
Server 发表基础架构”和网站作用的“SharePoint Server 发表”。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;

using System.IO;
using System.Windows.Markup;
using System.Windows.Media.Imaging;

namespace Silverlight40.UI
{
    public partial class DragAndDrop : Page
    {
        public DragAndDrop()
        {
            InitializeComponent();
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            listBox.AllowDrop = true;

            listBox.DragEnter += new DragEventHandler(listBox_DragEnter);
            listBox.DragLeave += new DragEventHandler(listBox_DragLeave);
            listBox.DragOver += new DragEventHandler(listBox_DragOver);
            listBox.Drop += new DragEventHandler(listBox_Drop);
        }

        void listBox_DragEnter(object sender, DragEventArgs e)
        {
            listBox.Items.Add(“DragEnter”);
        }

        void listBox_DragLeave(object sender, DragEventArgs e)
        {
            listBox.Items.Add(“DragLeave”);
        }

        void listBox_DragOver(object sender, DragEventArgs e)
        {
            // listBox.Items.Add(“DragOver”);
        }

        void listBox_Drop(object sender, DragEventArgs e)
        {
            listBox.Items.Add(“Drop”);

            if (e.Data == null)
                return;

            IDataObject dataObject = e.Data as IDataObject;
            FileInfo[] files = dataObject.GetData(DataFormats.FileDrop) as FileInfo[];

            foreach (FileInfo file in files)
            {
                if (file.Exists)
                    listBox.Items.Add(“FileName: ” + file.Name + ” [FileSize: ” + file.Length + “]”);
                else
                    list博克斯.Items.Add(“文件无效”);
            }
        }
    }
}

OK
[源码下载]