2011-11-06 54 views
0

有沒有一種控件可以用來在WPF中的Outlook選項(左「菜單」)下進行導航/選擇?或者我需要重新設置一個tabcontrol或類似的東西,如果是這樣,是否有一個例子使它看起來像Outlook選項?像Outlook中的Outlook導航選項WPF中的選項

回答

3

最後我再造型一ListBox,這裏是代碼:

<Grid x:Name="layoutRoot"> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="100" /> 
     <ColumnDefinition Width="5" /> 
     <ColumnDefinition Width="*" /> 
    </Grid.ColumnDefinitions> 

    <ListBox> 
     <ListBox.Resources> 
      <LinearGradientBrush x:Key="MouseOverBrush" EndPoint="0.5,1" StartPoint="0.5,0"> 
       <GradientStop Color="#FFFFFFFF" Offset="0" /> 
       <GradientStop Color="#FFFEF3B5" Offset="0.318" /> 
       <GradientStop Color="#FFFFEB70" Offset="0.488" /> 
       <GradientStop Color="#FFFFE48A" Offset="0.502" /> 
       <GradientStop Color="#FFFFD932" Offset="0.834" /> 
       <GradientStop Color="#FFFFF48B" Offset="1" /> 
      </LinearGradientBrush> 
      <LinearGradientBrush x:Key="MouseOverBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0"> 
       <GradientStop Color="#FFEEE8CF" Offset="0" /> 
       <GradientStop Color="#FFC4AF8C" Offset="0.536" /> 
       <GradientStop Color="#FFDCD1BF" Offset="1" /> 
      </LinearGradientBrush> 
      <LinearGradientBrush x:Key="PressedBrush" EndPoint="0.5,1" StartPoint="0.5,0"> 
       <GradientStop Color="#FFC3BCAE" Offset="0" /> 
       <GradientStop Color="#FFFFE48A" Offset="0.046" /> 
       <GradientStop Color="#FFFFE48A" Offset="0.452" /> 
       <GradientStop Color="#FFFFE48A" Offset="0.461" /> 
       <GradientStop Color="#FFFFD932" Offset="0.724" /> 
       <GradientStop Color="#FFFFF48B" Offset="1" /> 
      </LinearGradientBrush> 
      <LinearGradientBrush x:Key="PressedBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0"> 
       <GradientStop Color="#FFC2762B" Offset="0" /> 
       <GradientStop Color="#FFC29E47" Offset="1" /> 
      </LinearGradientBrush> 

      <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" /> 

      <Style TargetType="{x:Type ListBox}"> 
       <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"/> 
       <Setter Property="Padding" Value="1"/> 
      </Style> 

      <Style TargetType="ListBoxItem"> 
       <Setter Property="FocusVisualStyle" Value="{x:Null}" /> 
       <Setter Property="Template"> 
        <Setter.Value> 
         <ControlTemplate TargetType="ListBoxItem"> 
          <Border x:Name="OuterBorder" Margin="1" BorderThickness="1" CornerRadius="3" BorderBrush="Transparent" Background="Transparent"> 
           <Border x:Name="InnerBorder" BorderThickness="1" CornerRadius="2" BorderBrush="Transparent" Background="Transparent"> 
            <ContentPresenter x:Name="Content" Margin="10,3,10,3" /> 
           </Border> 
          </Border> 

          <ControlTemplate.Triggers> 
           <Trigger Property="IsEnabled" Value="False"> 
            <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}" /> 
           </Trigger> 
           <Trigger Property="IsMouseOver" Value="True"> 
            <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource MouseOverBorderBrush}" /> 
            <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource MouseOverBrush}" /> 
           </Trigger> 
           <MultiTrigger> 
            <MultiTrigger.Conditions> 
             <Condition Property="IsSelected" Value="True" /> 
             <Condition Property="IsMouseOver" Value="False" /> 
            </MultiTrigger.Conditions> 
            <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource PressedBorderBrush}" /> 
            <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource PressedBrush}" /> 
           </MultiTrigger> 
           <MultiTrigger> 
            <MultiTrigger.Conditions> 
             <Condition Property="IsSelected" Value="True" /> 
             <Condition Property="IsMouseOver" Value="True" /> 
            </MultiTrigger.Conditions> 
            <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource PressedBorderBrush}" /> 
            <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource PressedBrush}" /> 
           </MultiTrigger> 
          </ControlTemplate.Triggers> 
         </ControlTemplate> 
        </Setter.Value> 
       </Setter> 
      </Style> 
     </ListBox.Resources> 

     <ListBoxItem IsSelected="True">Item 1</ListBoxItem> 
     <ListBoxItem>Item 2</ListBoxItem> 
     <ListBoxItem>Itme 3</ListBoxItem> 
     <ListBoxItem>Item 4</ListBoxItem> 
     <ListBoxItem>Item 5</ListBoxItem> 
     <ListBoxItem IsEnabled="False"> 
      <Separator Margin="-5,0,-5,0" /> 
     </ListBoxItem> 
     <ListBoxItem>Item 6</ListBoxItem> 
     <ListBoxItem IsEnabled="False">Item 7</ListBoxItem> 
     <ListBoxItem>Item 8</ListBoxItem> 
     <ListBoxItem>Item 9</ListBoxItem> 
    </ListBox> 

    <Border Grid.Column="2" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" BorderThickness="1"> 
     <Grid></Grid> 
    </Border> 
</Grid> 
0

這是一個封裝MS Outlook NavigationPane功能的WPF控件。

看看這個鏈接http://navigationpane.codeplex.com/ 它完全支持WPF樣式,所以你可以通過自己的圖形喜好來設置它的風格,如果你是一個深藏在爐竈中的藝術家。 它配備了一個默認的樣式至極更像是2010年Outllok

+0

這看起來很像在選項窗口中的導航Outlook 2010,這就是我正在尋找的。如果我需要重新調整它可能會更容易使用選項卡控件。 – easp

+0

您可以在此圖片中看到我正在尋找的導航:[link](http://www.med.upenn.edu/perelmanrenaming/images/media_1306866664707.png) – easp