Browse Source

Change SharpTreeView to allow the use of ImageSources as icons.

pull/1/head
Daniel Grunwald 16 years ago
parent
commit
4e7235c96f
  1. 10
      SharpTreeView/SharpTreeNode.cs
  2. 28
      SharpTreeView/Themes/Generic.xaml

10
SharpTreeView/SharpTreeNode.cs

@ -151,15 +151,9 @@ namespace ICSharpCode.TreeView
} }
} }
bool showIcon; public virtual bool ShowIcon
public bool ShowIcon
{ {
get { return showIcon; } get { return Icon != null; }
set {
showIcon = value;
RaisePropertyChanged("ShowIcon");
}
} }
public virtual void LoadChildren() public virtual void LoadChildren()

28
SharpTreeView/Themes/Generic.xaml

@ -248,19 +248,25 @@
<StackPanel Orientation="Horizontal" <StackPanel Orientation="Horizontal"
Background="Transparent" Background="Transparent"
ToolTip="{Binding ToolTip}"> ToolTip="{Binding ToolTip}">
<ContentControl Name="icon" <ContentPresenter Name="icon"
Content="{Binding Icon}" Content="{Binding Icon}"
Width="16" Width="16"
Height="16" Height="16"
Margin="0 0 5 1" Margin="0 0 5 1"
VerticalAlignment="Center" VerticalAlignment="Center"
Focusable="False" /> Focusable="False">
<ContentPresenter.ContentTemplate>
<DataTemplate>
<Image Source="{Binding}"/>
</DataTemplate>
</ContentPresenter.ContentTemplate>
</ContentPresenter>
<Border Name="textContainer" <Border Name="textContainer"
Background="{TemplateBinding TextBackground}"> Background="{TemplateBinding TextBackground}">
<ContentControl Content="{Binding Text}" <ContentPresenter Content="{Binding Text}"
Margin="2 0 6 0" Margin="2 0 6 0"
VerticalAlignment="Center" VerticalAlignment="Center"
Focusable="False" /> Focusable="False" />
</Border> </Border>
<Border Name="textEditorContainer" /> <Border Name="textEditorContainer" />
</StackPanel> </StackPanel>

Loading…
Cancel
Save