Message 1 of 12
Not applicable
03-24-2016
04:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Palette code
<CommandMethod("myfirstwpfuc", CommandFlags.Session)>
Public Sub myfirstudercontrol()
Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor
Dim firstadd As Boolean = False
If autocadPaletteset = Nothing Then
autocadPaletteset = New PaletteSet("Modify attributes", New Guid("{773D4B0E-98A8-4AB4-9711-D80898DE40C0}"))
'autocadPaletteset.Style = PaletteSetStyles.ShowAutoHideButton Or PaletteSetStyles.ShowCloseButton Or PaletteSetStyles.Snappable
autocadPaletteset.Style = PaletteSetStyles.ShowCloseButton
autocadPaletteset.Style = PaletteSetStyles.ShowAutoHideButton
autocadPaletteset.Style = PaletteSetStyles.Snappable
autocadPaletteset.Style = PaletteSetStyles.ShowPropertiesMenu
autocadPaletteset.Style = PaletteSetStyles.ShowTabForSingle
Dim elementhost As ElementHost = New System.Windows.Forms.Integration.ElementHost
elementhost.Dock = DockStyle.Fill
Dim UC2 As New View_ATT
elementhost.Child = UC2
autocadPaletteset.Dock = DockSides.None
autocadPaletteset.DockEnabled = DockSides.None
'autocadPaletteset.AddVisual("Modify", UC2)
autocadPaletteset.Add("P", elementhost)
firstadd = True
autocadPaletteset.Visible = True
End If
End Sub
Xaml code
<UserControl x:Class="View_ATT"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SchneiderMacros"
mc:Ignorable="d"
d:DesignHeight="230" d:DesignWidth="325">
<Grid Background="#FF007ACC">
<StackPanel Margin="5 " Background="#FF252526">
<StackPanel Orientation="Horizontal" >
<TextBlock x:Name="Block" Width=" 30" Margin=" 5" Text="Block " Foreground="#FFE6E6EE" FontWeight="Bold" TextDecorations="{x:Null}"/>
<StackPanel >
<TextBlock x:Name="txtBlkName" Width=" 150" Margin=" 2" Foreground="#FFEAEAF3" Text="{Binding blkname,Mode=TwoWay,NotifyOnSourceUpdated=True}"></TextBlock>
<TextBlock x:Name="txtblkBLKID" Width=" 150" Margin=" 2" Foreground="#FFDADAE4" Text="{Binding blockid,Mode=TwoWay,NotifyOnSourceUpdated=True}"></TextBlock>
</StackPanel>
<Button x:Name="GetAtt" Width="85" Margin=" 2" Content="Get Attributes"></Button>
<Image Source="S:\Transfer\Pankaj_Potdar\acadplugin\unnamed.png" Height="28" Width="28" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin=" 5">
<StackPanel Margin=" 2" HorizontalAlignment="Left" Width="140">
<TextBlock x:Name="tagDL" Margin="2 " Height=" 20" Text="{Binding tagDL,Mode=TwoWay,NotifyOnSourceUpdated=True}" Foreground="#FFD1D1E2" ></TextBlock>
<TextBlock x:Name="tagDN" Margin=" 2" Height=" 20" Text="{Binding tagDN,Mode=TwoWay,NotifyOnSourceUpdated=True}" Foreground="#FFD1D1E2"></TextBlock>
<TextBlock x:Name="tagSQDPN" Margin=" 2" Height=" 20" Text="{Binding tagsqdpn,Mode=TwoWay,NotifyOnSourceUpdated=True}" Foreground="#FFD1D1E2"></TextBlock>
<TextBlock x:Name="tagMODEL" Margin=" 2" Height=" 20" Text="{Binding tagmodel,Mode=TwoWay,NotifyOnSourceUpdated=True}" Foreground="#FFD1D1E2"></TextBlock>
<TextBlock x:Name="tagMANUFACTURER" Margin=" 2" Height=" 20" Text="{Binding tagmanufacturer,Mode=TwoWay,NotifyOnSourceUpdated=True}" Foreground="#FFD1D1E2"></TextBlock>
</StackPanel>
<StackPanel Margin=" 2" HorizontalAlignment="Right" Width="140">
<TextBox x:Name="txtboxDL" Margin="2 " Height=" 20" Text="{Binding devicelocation,Mode=TwoWay,NotifyOnSourceUpdated=True}"/>
<TextBox x:Name="txtboxDN" Margin="2 " Height=" 20" Text="{Binding devicename,Mode=TwoWay,NotifyOnSourceUpdated=True}"/>
<TextBox x:Name="txtboxSQDPN" Margin="2 " Height=" 20" Text="{Binding sqdpn,Mode=TwoWay,NotifyOnSourceUpdated=True}"/>
<TextBox x:Name="txtboxMODEL" Margin="2 " Height=" 20" Text="{Binding model,Mode=TwoWay,NotifyOnSourceUpdated=True}"/>
<TextBox x:Name="txtboxMANUFACTURER" Margin="2 " Height=" 20" Text="{Binding manufacturer,Mode=TwoWay,NotifyOnSourceUpdated=True}"/>
</StackPanel>
<StackPanel Margin=" 2">
<CheckBox x:Name="sqdpnhdn" Margin="2,53,2,2" HorizontalAlignment="Center" IsChecked="{Binding hidden, Mode=TwoWay, NotifyOnSourceUpdated=True}"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<Button x:Name="btnUpdate" Width="50 " Height=" 25" Margin=" 10" HorizontalAlignment="Left" Content="Update "></Button>
<Image Source="S:\Transfer\Pankaj_Potdar\acadplugin\Schneider-Electric_White.png" Height="45" Width="68" Margin=" 170,0,0,0" Stretch="Fill"/>
</StackPanel>
</StackPanel>
</Grid>
</UserControl>
WPF Palette get loaded sucessfully but can not see close button, auto hide or properties menu on palette
Solved! Go to Solution.