Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StartGUI
- {
- [CommandMethod("startplagin")]
- public static void StartPlagin()
- {
- MainView mainView = new MainView();
- autoDSK.ShowModelessWindow(mainView);
- mainView.DataContext = new ViewModel.MainViewModel();
- }
- }
- public class MainViewModel:INotifyPropertyChanged
- {
- #region PropertyChangedEventHandler
- /// <summary>
- /// Метод проверяющий изменилось ли свойство
- /// </summary>
- public event PropertyChangedEventHandler PropertyChanged;
- protected virtual void OnPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- #endregion
- private ShowLayersViewModel _showLayers;
- private ColorPickerViewModel _colorPicker;
- private string _visibleColorPicker;
- public MainViewModel()
- {
- ColorPicker = new ColorPickerViewModel();
- ShowLayers = new ShowLayersViewModel();
- //ColorPicker.VisibleColorPicker = "Collapsed";
- VisibleColorPicker = "Collapsed";
- ClickCommandVisible = new Command(arg =>
- {
- VisibleColorPicker = "Collapsed";
- });
- }
- public ShowLayersViewModel ShowLayers
- {
- get { return _showLayers; }
- set { _showLayers = value; OnPropertyChanged("ShowLayers");}
- }
- public ColorPickerViewModel ColorPicker
- {
- get { return _colorPicker; }
- set { _colorPicker = value; OnPropertyChanged("ColorPicker"); }
- }
- public string VisibleColorPicker
- {
- get { return _visibleColorPicker; }
- set { _visibleColorPicker = value; OnPropertyChanged("VisibleColorPicker"); }
- }
- public ICommand ClickCommandVisible { get; set; }
- }
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="25" />
- <RowDefinition Height="150" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Button Grid.Row="0" Command="{Binding ClickCommandVisible}" />
- <userControls:ShowLayers Grid.Row="1" DataContext="{Binding ShowLayers}" />
- <userControls:ColorPicker
- Grid.Row="2"
- DataContext="{Binding ColorPicker}"
- Visibility="{Binding VisibleColorPicker}" />
- </Grid>
Add Comment
Please, Sign In to add comment