fixed #192
This commit is contained in:
1 parent
d9b94f83fe
commit
7f0330856d
20 files changed
+1159
-52
No files matched your search
@@ -2,6 +2,7 @@
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using HandyControl.Tools.Extension;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.ViewModel;
|
||||
|
||||
|
||||
namespace HandyControlDemo.UserControl
|
||||
@@ -13,6 +14,8 @@ namespace HandyControlDemo.UserControl
|
||||
{
|
||||
private bool _isFull;
|
||||
|
||||
private string _currentDemoKey;
|
||||
|
||||
public MainContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -43,5 +46,25 @@ namespace HandyControlDemo.UserControl
|
||||
PresenterMain.Margin = new Thickness(0, 0, 0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawerCode_OnOpened(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var typeKey = ViewModelLocator.Instance.Main.DemoInfoCurrent.Key;
|
||||
var demoKey = ViewModelLocator.Instance.Main.DemoItemCurrent.TargetCtlName;
|
||||
if (Equals(_currentDemoKey, demoKey)) return;
|
||||
_currentDemoKey = demoKey;
|
||||
|
||||
if (ViewModelLocator.Instance.Main.SubContent is FrameworkElement demoCtl)
|
||||
{
|
||||
var xamlPath = $"UserControl/{typeKey}/{demoCtl.GetType().Name}.xaml";
|
||||
var dc = demoCtl.DataContext;
|
||||
var dcTypeName = dc.GetType().Name;
|
||||
var vmPath = $"ViewModel/{dcTypeName}";
|
||||
|
||||
EditorXaml.Text = DemoHelper.GetCode(xamlPath);
|
||||
EditorCs.Text = DemoHelper.GetCode($"{xamlPath}.cs");
|
||||
EditorVm.Text = DemoHelper.GetCode($"{vmPath}.cs");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user