トップ回答者
リボンコントロールに表示されるGalleryコントロールについて

質問
回答
-
こんな?
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="300" Width="400" xmlns:app="clr-namespace:WpfApplication1"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition/> </Grid.RowDefinitions> <Ribbon x:Name="Ribbon1"> <Ribbon.ApplicationMenu> <RibbonApplicationMenu > <RibbonApplicationMenuItem Header="MenuItem0" /> <RibbonApplicationMenuItem Header="MenuItem1" /> <RibbonApplicationMenuItem Header="MenuItem2" /> </RibbonApplicationMenu> </Ribbon.ApplicationMenu> <RibbonTab Header="Tab1" DataContext="ABCDEFGHIJKLMNOPQRSTUVWXYZ"> <RibbonGroup Header="Group1"> <RibbonControl > <RibbonControl.ContentTemplate> <DataTemplate> <Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type RibbonControl}}}"> <ListBox ItemsSource="{Binding Path=.}" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Hidden" > <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Width="250" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Border Width="50" Height="50" Background="LightPink" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> </DataTemplate> </ListBox.ItemTemplate> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}" > <Setter Property="Padding" Value="2" /> <Setter Property="Margin" Value="1" /> </Style> </ListBox.ItemContainerStyle> </ListBox> <RibbonSplitButton Width="20" Height="20" HorizontalAlignment="Left" VerticalAlignment="Bottom" > <RibbonGallery> <RibbonGalleryCategory ItemsSource="{Binding Path=.}" MaxColumnCount="10" Height="300" Width="600"> <RibbonGalleryCategory.ItemTemplate> <DataTemplate> <Border Width="50" Height="50" Background="LightPink" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> </DataTemplate> </RibbonGalleryCategory.ItemTemplate> </RibbonGalleryCategory> </RibbonGallery> </RibbonSplitButton> </Grid> </DataTemplate> </RibbonControl.ContentTemplate> </RibbonControl> </RibbonGroup> </RibbonTab> </Ribbon> </Grid> </Window>
個別に明示されていない限りgekkaがフォーラムに投稿したコードにはフォーラム使用条件に基づき「MICROSOFT LIMITED PUBLIC LICENSE」が適用されます。(かなり自由に使ってOK!)
- 回答としてマーク yty0918 2015年8月5日 10:00
すべての返信
-
こんな?
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="300" Width="400" xmlns:app="clr-namespace:WpfApplication1"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition/> </Grid.RowDefinitions> <Ribbon x:Name="Ribbon1"> <Ribbon.ApplicationMenu> <RibbonApplicationMenu > <RibbonApplicationMenuItem Header="MenuItem0" /> <RibbonApplicationMenuItem Header="MenuItem1" /> <RibbonApplicationMenuItem Header="MenuItem2" /> </RibbonApplicationMenu> </Ribbon.ApplicationMenu> <RibbonTab Header="Tab1" DataContext="ABCDEFGHIJKLMNOPQRSTUVWXYZ"> <RibbonGroup Header="Group1"> <RibbonControl > <RibbonControl.ContentTemplate> <DataTemplate> <Grid DataContext="{Binding Path=DataContext,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type RibbonControl}}}"> <ListBox ItemsSource="{Binding Path=.}" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Hidden" > <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Width="250" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Border Width="50" Height="50" Background="LightPink" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> </DataTemplate> </ListBox.ItemTemplate> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}" > <Setter Property="Padding" Value="2" /> <Setter Property="Margin" Value="1" /> </Style> </ListBox.ItemContainerStyle> </ListBox> <RibbonSplitButton Width="20" Height="20" HorizontalAlignment="Left" VerticalAlignment="Bottom" > <RibbonGallery> <RibbonGalleryCategory ItemsSource="{Binding Path=.}" MaxColumnCount="10" Height="300" Width="600"> <RibbonGalleryCategory.ItemTemplate> <DataTemplate> <Border Width="50" Height="50" Background="LightPink" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> </DataTemplate> </RibbonGalleryCategory.ItemTemplate> </RibbonGalleryCategory> </RibbonGallery> </RibbonSplitButton> </Grid> </DataTemplate> </RibbonControl.ContentTemplate> </RibbonControl> </RibbonGroup> </RibbonTab> </Ribbon> </Grid> </Window>
個別に明示されていない限りgekkaがフォーラムに投稿したコードにはフォーラム使用条件に基づき「MICROSOFT LIMITED PUBLIC LICENSE」が適用されます。(かなり自由に使ってOK!)
- 回答としてマーク yty0918 2015年8月5日 10:00