This repository has been archived by the owner on Apr 9, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Greatly improved TabbedLayout behavior when bound to Categories
- Loading branch information
Denis Vuyka
committed
Mar 10, 2011
1 parent
6080ef6
commit 824c93f
Showing
4 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Main/WpfPropertyGrid/Design/TabbedLayoutTemplateSelector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace System.Windows.Controls.WpfPropertyGrid.Design | ||
{ | ||
public class TabbedLayoutTemplateSelector : DataTemplateSelector | ||
{ | ||
private readonly ResourceLocator _resourceLocator = new ResourceLocator(); | ||
|
||
public override DataTemplate SelectTemplate(object item, DependencyObject container) | ||
{ | ||
var category = item as CategoryItem; | ||
if (category != null) | ||
{ | ||
var template = FindEditorTemplate(category); | ||
if (template != null) return template; | ||
} | ||
|
||
return base.SelectTemplate(item, container); | ||
} | ||
|
||
protected virtual DataTemplate FindEditorTemplate(CategoryItem category) | ||
{ | ||
if (category == null) return null; | ||
|
||
var editor = category.Editor; | ||
|
||
if (editor == null) return null; | ||
|
||
var template = editor.InlineTemplate as DataTemplate; | ||
if (template != null) return template; | ||
|
||
return _resourceLocator.GetResource(editor.InlineTemplate) as DataTemplate; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters