Home Forums WPF controls Xceed Toolkit Plus for WPF IntegerUpDown in DLL

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • xinyu
    Participant
    Post count: 2
    #44078 |

    Hello,

    I’m using IntegerUpDown in Xaml. If is is a WPF-Application, it works without any problem. But if I try to use it in a “Class library” project with a WPF-Window, I get an error message:
    Cannot create an instance of 'Xceed-Wpf_Toolkit_IntegerUpDown_317_115878824
    My Xaml code:

    <Window x:Class="TstWpfDll.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            mc:Ignorable="d"
            xmlns:wpfx="http://schemas.xceed.com/wpf/xaml/toolkit"
            Title="MainWindow" Height="350" Width="525">
       
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <wpfx:IntegerUpDown Text="0" Grid.Row="0"/>
            <TextBox Text="hello" Grid.Row="1"/>
        </Grid>
    </Window>

    If I use DecimalUpDown, it works.

    I use VS 2015.

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi,

    DecimalUpDown and IntegerUpDown shouldn’t react differently when defined in a WPF-Application or Class library. It should work as expected.
    Can you submit the sample so we can execute it and reproduce your issue, and have a look at your sample’s configuration ?
    Thanks.

    xinyu
    Participant
    Post count: 2

    Hi,
    it turns out, that the error occurs, if I use IntegerUpDown with Telerik-controls. There is no comile or run time error, but in Xaml Editor, I get “‘AllowSpin’ property was already registered by ‘Xceed_Wpf_Toolkit_Primitives_UpDownBase`1_15_190194770′” error.

    MainWindow.xaml:

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:local="clr-namespace:WpfApplication1"
            mc:Ignorable="d"
            xmlns:wpfx="http://schemas.xceed.com/wpf/xaml/toolkit"
            xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
            Title="MainWindow" Height="350" Width="525">
        
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <telerik:RadTabControl Grid.Row="1">
                <telerik:RadTabControl.Items>
        
                    <telerik:RadTabItem Header="Properties">
                        <telerik:RadTabItem.Content>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto"/>
                                </Grid.RowDefinitions>
                                <telerik:RadGridView Grid.Row="0" ItemsSource="{Binding KVList}" AutoGenerateColumns="False" >
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Key}" Header="Key" IsReadOnly="True"/>
                                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Type}" Header="Type" IsReadOnly="True"/>
                                        <telerik:GridViewDataColumn IsReadOnly="False" Header="Value">
                                            <telerik:GridViewDataColumn.CellTemplate>
                                                <DataTemplate>
                                                    <ContentControl Content="{Binding}">
                                                        <ContentControl.Style>
                                                            <Style TargetType="ContentControl">
                                                                
                                                                <Setter Property="ContentTemplate">
                                                                    <Setter.Value>
                                                                        <DataTemplate>
                                                                            <TextBox Text="{Binding Value}" />
                                                                        </DataTemplate>
                                                                    </Setter.Value>
                                                                </Setter>
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding Type}" Value="tk_double">
                                                                        <Setter Property="ContentTemplate">
                                                                            <Setter.Value>
                                                                                <DataTemplate>
                                                                                    <wpfx:DecimalUpDown Text="{Binding Value}"/>
                                                                                </DataTemplate>
                                                                            </Setter.Value>
                                                                        </Setter>
                                                                    </DataTrigger>
                                                                    <DataTrigger Binding="{Binding Type}" Value="tk_integer">
                                                                        <Setter Property="ContentTemplate">
                                                                            <Setter.Value>
                                                                                <DataTemplate>
                                                                                    <wpfx:IntegerUpDown Text="{Binding Value}" Minimum="0"/>
                                                                                </DataTemplate>
                                                                            </Setter.Value>
                                                                        </Setter>
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </ContentControl.Style>
                                                    </ContentControl>
                                                </DataTemplate>
                                            </telerik:GridViewDataColumn.CellTemplate>
                                        </telerik:GridViewDataColumn>
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                            </Grid>
                        </telerik:RadTabItem.Content>
                    </telerik:RadTabItem>
                </telerik:RadTabControl.Items>
            </telerik:RadTabControl>
        </Grid>
    </Window>

    MainWindow.xaml.cs:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace WpfApplication1
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public class Data
            {
                public string Key { get; set; }
                public string Type { get; set; }
                public string Value { get; set; }
            }
    
            private List<Data> _list;
            public MainWindow()
            {
                InitializeComponent();
                this.DataContext = this;
                _list = new List<Data>();
                var d1 = new Data() { Key = "k1", Type = "tk_double", Value = "0" };
                var d2 = new Data() { Key = "k2", Type = "tk_integer", Value = "0" };
                _list.Add(d1);
                _list.Add(d2);
            }
    
            public List<Data> KVList
            {
                get { return _list; }
                set { _list = value; }
            }
        }
    
    }

    The project is Class Library.

    Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.