Hi all.
I have a WPF non-addin UserControl library. Now i want to use controls in this library in my AddIn Project.
I tried the following code
<customControl id="ucs_lib" caption="Text Color" className="ControlLibrary.XColorPickerViewModel" assembly="ControlLibrary.dll" loadOnClick="true" smallImage="GenericButtonPurple16" largeImage="GenericButtonPurple32">
<content className="ControlLibrary.XColorPicker" assembly="ControlLibrary.dll" />
<tooltip heading="Text color">
<disabledText />
</tooltip>
</customControl>
...
<group id="text_group">
<customControl refID="ucs_lib" size="large" />
</group>
But this control not shown. What's wrong here?
What proper way to reference user control from non-addin library?
Thanks.
Solved! Go to Solution.
Hi,
Do you want to use your custom control in ribbon or ProWindow/ Dockpanel?
If you want to use it in ribbon, then create new ArcGIS Pro Custom Control and place your control inside.
For both cases you need to add reference to your library at the start of your xaml:
<UserControl x:Class="ProAppModule4.CustomControl1View"
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:ui="clr-namespace:ProAppModule4"
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
xmlns:myuc="clr-namespace:ControlLibrary.XColorPicker;assembly=ControlLibrary"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
d:DataContext="{Binding Path=ui.CustomControl1ViewModel}">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid >
<myuc:XColorPicker />
</Grid>
</UserControl>
And add your library reference to project.
Hi,
Do you want to use your custom control in ribbon or ProWindow/ Dockpanel?
If you want to use it in ribbon, then create new ArcGIS Pro Custom Control and place your control inside.
For both cases you need to add reference to your library at the start of your xaml:
<UserControl x:Class="ProAppModule4.CustomControl1View"
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:ui="clr-namespace:ProAppModule4"
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
xmlns:myuc="clr-namespace:ControlLibrary.XColorPicker;assembly=ControlLibrary"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
d:DataContext="{Binding Path=ui.CustomControl1ViewModel}">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid >
<myuc:XColorPicker />
</Grid>
</UserControl>
And add your library reference to project.
Thanks.
I know i can use a UserControl as container for external UserControl. So no way to directly put external UserControl to Config.daml, right?
Is your solution the proper way to put external non-addin UserControl to add-in project?
There would be no need to have such Custom Control if it could be done without it. Another one thing that all controls defined in DAML must implement IPlugInWrapper interface. I am not sure that your custom control implements IPlugInWrapper interface.