WPF finishing papers WPF controls embedded Winfrom

Original: WPF finishing papers WPF controls embedded Winfrom

To increase support DLL

Use WindowsFormsHost to load Forms controls

Namespace references

    xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
 
 

  
  
  1. <WindowsFormsHost Grid.Column= "1">
  2. <forms:PropertyGrid x:Name= "Property">
  3. </forms:PropertyGrid>
  4. </WindowsFormsHost>

effect

Code 


  
  
  1. <Grid>
  2. <Grid.ColumnDefinitions>
  3. <ColumnDefinition Width= "322*"/>
  4. <ColumnDefinition Width= "195*"/>
  5. </Grid.ColumnDefinitions>
  6. <TextBlock x:Name= "TextBlock" TextWrapping= "Wrap" Text= "TextBlock" />
  7. <WindowsFormsHost Grid.Column= "1">
  8. <forms:PropertyGrid x:Name= "Property">
  9. </forms:PropertyGrid>
  10. </WindowsFormsHost>
  11. </Grid>

  
  
  1. public MainWindow()
  2. {
  3. InitializeComponent();
  4. Property.SelectedObject = TextBlock;
  5. }

 

Guess you like

Origin www.cnblogs.com/lonelyxmas/p/12075539.html