wrapped custom widget items in containers so we have more control of the surrounding, i.e. divider
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Hyperbar.Windows.UI;
|
||||
|
||||
public class TemplateGeneratorControl :
|
||||
ContentControl
|
||||
{
|
||||
public TemplateGeneratorControl()
|
||||
{
|
||||
DataContextChanged += OnDataContextChanged;
|
||||
}
|
||||
|
||||
private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
|
||||
{
|
||||
if (DataContext is ITemplatedViewModel templatedViewModel)
|
||||
{
|
||||
Content = templatedViewModel.TemplateFactory.Create(DataContext.GetType().Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user