Browse Source

Change SharpTreeView to allow the use of ImageSources as icons.

pull/1/head
Daniel Grunwald 14 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 @@ -151,15 +151,9 @@ namespace ICSharpCode.TreeView
}
}
bool showIcon;
public bool ShowIcon
public virtual bool ShowIcon
{
get { return showIcon; }
set {
showIcon = value;
RaisePropertyChanged("ShowIcon");
}
get { return Icon != null; }
}
public virtual void LoadChildren()

28
SharpTreeView/Themes/Generic.xaml

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

Loading…
Cancel
Save