コード例 #1
0
 public ShapesExporterControl()
 {
     DefaultStyleKey = typeof(ShapesExporterControl);
     this.viewModel  = new ShapesExporterViewModel();
     DataContext     = viewModel;
     BindingOperations.SetBinding(this, PressedProperty, new Binding("Pressed"));
 }
コード例 #2
0
        static object CoerceFileTypeChanged(DependencyObject d, object baseValue)
        {
            ShapesExporterViewModel viewmodel = d as ShapesExporterViewModel;

            if (viewmodel == null)
            {
                return(DefaultFileType);
            }
            ListBoxEditItem item = baseValue as ListBoxEditItem;

            return(item == null ? viewmodel.SelectedFileType : item.Content);
        }