Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • 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 1 post (of 1 total)