<ListBox Padding="0" DockPanel.Dock="Left" VerticalAlignment="Center" x:Name="lbBreadCrumb" MinWidth="300" Background="Transparent" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" SelectionChanged="ListBox_SelectionChanged"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel Margin="8,0,0,0" Orientation="Horizontal"></StackPanel> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="LightGray"/> <Setter Property="BorderBrush" Value="LightGray"/> <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/> <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/> <Setter Property="Padding" Value="0"/> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <DockPanel LastChildFill="True" Margin="-8,0,0,0"> <Path x:Name="ArrowTip" DockPanel.Dock="Left" Stroke="LightGray" Fill="LightGray" Data="F1 M 112,144L 104,144L 112,160L 104,176L 112,176" Stretch="Fill" Height="32" Width="12" /> <Path x:Name="Arrow" DockPanel.Dock="Right" Stroke="LightGray" Fill="LightGray" Data="F1 M 168,144L 176,160L 168,176" Stretch="Fill" Height="32" Width="12" /> <Border Name="Border" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Background="{TemplateBinding Background}" BorderBrush="LightGray" Padding="{TemplateBinding Padding}" BorderThickness="0,1,0,1" VerticalAlignment="Center" Margin="-1,0,-1,0" > <ContentPresenter /> </Border> </DockPanel> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter TargetName="Border" Property="Background" Value="Gray"/> <Setter TargetName="Arrow" Property="Fill" Value="Gray"/> <Setter TargetName="ArrowTip" Property="Fill" Value="Gray"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="Red"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </ListBox.ItemContainerStyle> <ListBox.ItemTemplate> <DataTemplate> <DataTemplate.Resources> <local:ContentToVisibilityConverter x:Key="c2vConverter" /> </DataTemplate.Resources> <DockPanel VerticalAlignment="Center" Height="30"> <Label DockPanel.Dock="Left" FontSize="8" Content="{Binding Name, FallbackValue=Tagname NA}" VerticalAlignment="Center" Name="lb"/> <Button Width="20" Height="20" Background="#FF1D5BBA" Margin="0" Style="{StaticResource GlassButton}" Visibility="{Binding ElementName=lb, Path=Content., Converter={StaticResource c2vConverter}}"> <Image Width="15" Height="15" Source="images\refresh.png" ToolTip="Refresh Dashboard" MouseLeftButtonDown="RefreshImage_MouseLeftButtonDown" /> </Button> </DockPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
Saturday, April 21, 2012
WPF Breadcrumb markup
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment