2012-12-07 27 views
0

是否有.NET WinForms或WPF的組件用於創建帶有圖標的ControlPanel樣式佈局?
我想要一個看起來像控制面板的窗口,並在其中有可變數量的圖標。是否有組件可以用圖標創建ControlPanel樣式的佈局?

+0

UniformGrid或WrapPanel可能是你正在尋找的東西。 – TimothyP

+0

這是一個Winforms ListView。查看= Tiles或LargeIcon或SmallIcon,具體取決於您選擇的「View by」選項。 –

回答

0

例如:

<UniformGrid> 
    <StackPanel Orientation="Horizontal" 
       VerticalAlignment="Top"> 
     <Image Width="48" 
       Height="48" 
       Source="appbar.forklift.load.png" /> 
     <TextBlock VerticalAlignment="Center"> 
      <Hyperlink>Action Center</Hyperlink> 
     </TextBlock> 
    </StackPanel> 
    <StackPanel Orientation="Horizontal" 
       VerticalAlignment="Top"> 
     <Image Width="48" 
       Height="48" 
       Source="appbar.forrst.png" /> 
     <TextBlock VerticalAlignment="Center"> 
      <Hyperlink>Keyboard</Hyperlink> 
     </TextBlock> 
    </StackPanel> 
    <StackPanel Orientation="Horizontal" 
       VerticalAlignment="Top"> 
     <Image Width="48" 
       Height="48" 
       Source="appbar.forklift.png" /> 
     <TextBlock VerticalAlignment="Center"> 
      <Hyperlink>Notification</Hyperlink> 
     </TextBlock> 
    </StackPanel> 
    <StackPanel Orientation="Horizontal" 
       VerticalAlignment="Top"> 
     <Image Width="48" 
       Height="48" 
       Source="appbar.forklift.load.png" /> 
     <TextBlock VerticalAlignment="Center"> 
      <Hyperlink>Region</Hyperlink> 
     </TextBlock> 
    </StackPanel> 
    <StackPanel Orientation="Horizontal" 
       VerticalAlignment="Top"> 
     <Image Width="48" 
       Height="48" 
       Source="appbar.forklift.load.png" /> 
     <TextBlock VerticalAlignment="Center"> 
      <Hyperlink>Speech</Hyperlink> 
     </TextBlock> 
    </StackPanel>  
</UniformGrid> 

您可以添加你想要他們進行佈局爲你的多。 (一個wrappanel可能會更好,這取決於你真正想要的)。

如果您使用MVVM,則可以將每個鏈接的「Command」屬性綁定到ViewModel 上的命令。

<HyperLink Command="{Binding OpenActionLinkCenterCommand}">Action Center</HyperLink> 

如果你想買的東西來自一個集合,你可以使用ItemsContainer或列表框 並更改ItemsPanel模板

<ListBox ItemsSource="{Binding YourControlPanelItems}"> 
     <ListBox.ItemsPanel> 
      <ItemsPanelTemplate> 
       <UniformGrid/> 
      </ItemsPanelTemplate> 
     </ListBox.ItemsPanel> 
</ListBox> 

當然還有更多做的方式,這只是一個小例子。

+0

我們有3.5的東西嗎? – Artem

+0

你是什麼意思?由於這些控件自第一版 – TimothyP

+0

以來一直在那裏,對不起,我已經想通了:) – Artem

相關問題