fixed a bug of demo

This commit is contained in:
NaBian committed 2020-04-10 00:47:31 +08:00
1 parent 8c7f34ad4a
commit add2fd8237
6 files changed
+106 -6

No files matched your search

@@ -56,10 +56,13 @@ namespace HandyControlDemo.UserControl
if (ViewModelLocator.Instance.Main.SubContent is FrameworkElement demoCtl)
{
var xamlPath = $"UserControl/{typeKey}/{demoCtl.GetType().Name}.xaml";
var demoCtlTypeName = demoCtl.GetType().Name;
var xamlPath = $"UserControl/{typeKey}/{demoCtlTypeName}.xaml";
var dc = demoCtl.DataContext;
var dcTypeName = dc.GetType().Name;
var vmPath = $"ViewModel/{dcTypeName}";
var vmPath = !Equals(dcTypeName, demoCtlTypeName)
? $"ViewModel/{dcTypeName}"
: xamlPath;
EditorXaml.Text = DemoHelper.GetCode(xamlPath);
EditorCs.Text = DemoHelper.GetCode($"{xamlPath}.cs");