This is a migrated thread and some comments may be shown as answers.

Enumerator gives error in XAML

7 Answers 37 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jonam
Top achievements
Rank 1
Jonam asked on 07 Mar 2011, 09:50 AM
http://www.telerik.com/help/silverlight/radcombobox-howto-bind-enum-values.html

i used the methode above to databind an enumerator to a combobox. The method works perfect only in the designer i get an error that the enumerator type is unkown.

<

 

 

model:EnumViewModel x:Name="KavelVerdelingSource" EnumType="System.Windows.Controls.ClickMode"/>

Error 26 Type 'System.Windows.Controls.ClickMode' was not found. C:\Projects\Klanten\Rekenenteken - kopie\Brink Interface\Main\Controls\DataControls\BestaandKavelDataControl.xaml 18 9 Brink Interface

any suggestions?


 

7 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 10 Mar 2011, 05:06 PM
Hi Jonam,

The reason for this error is that the typeconverter is not executed at designtime. You can fix it by changing the type of EnumType property to string and convert it later in EnumViewModel class. I've attached an example, please download it and examine it.

Best wishes,
Yana
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Jonam
Top achievements
Rank 1
answered on 11 Mar 2011, 09:21 AM
Hello Yana,

thank you. The solutions worked perfect for me!

kind regards,

Jonam
0
Jonam
Top achievements
Rank 1
answered on 11 Mar 2011, 11:04 AM
Sorry works perfect except when you have a datatemplate somewhere in the control. If you have a datatemplate somwhere you get an Invalid XAML exception?

0
Yana
Telerik team
answered on 14 Mar 2011, 04:49 PM
Hello Jonam,

Could you please send us sample code as we're not able to reproduce the described issue? Thanks

All the best,
Yana
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Jonam
Top achievements
Rank 1
answered on 16 Mar 2011, 12:13 PM
<local:DataControl 
    x:Class="Brink_Interface.Main.Controls.DataControls.PlangebiedDataControl"
    xmlns:local="clr-namespace:Brink_Interface.Main.Controls.DataControls"
    xmlns:paladinContainerControls="clr-namespace:Brink_Interface.Themes.Templated_Controls"
    xmlns:paladinSubControls="clr-namespace:Brink_Interface.Main.Controls.DataControls.SubControls"
    xmlns:Brink_Interface="clr-namespace:Brink_Interface"  
    xmlns:myControl="clr-namespace:Brink_Interface.Main.Controls.DataControls.SubControls"
    xmlns:model="clr-namespace:Brink_Interface.Models"
    mc:Ignorable="d"
    Language="nl-NL"
    d:DesignHeight="721" d:DesignWidth="332" 
    BorderThickness="1" 
    Background="Transparent">
  
    <UserControl.Resources>
  
        <model:EnumViewModel x:Name="KavelVerdelingSource" EnumType="Brink_Interface.PlangebiedService.VerdeelAlgorithmes"/>
  
        <telerik:HierarchicalDataTemplate x:Key="DetailsTemplate">
            <telerik:RadPanelBar>
                <telerik:RadPanelBarItem IsExpanded="True">
                    <telerik:RadPanelBarItem.Header>
                        <Grid Background="Transparent">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="163*" />
                                <ColumnDefinition Width="102*" />
                            </Grid.ColumnDefinitions>
  
                            <sdk:Label Content="{Binding Naam}" Margin="5,0,0,0" />
  
                            <StackPanel Grid.Column="1" Orientation="Horizontal" FlowDirection="RightToLeft">
                                <telerik:RadButton Name="btnDeleteKostenRegel" Click="btnDeleteKostenRegel_Click" CommandParameter="{Binding Id}" ToolTipService.ToolTip="Post verwijderen">
                                    <telerik:RadButton.Content>
                                        <Image Source="/Brink%20Interface;component/Assets/Icons/delete.png" Width="14" Height="14" />
                                    </telerik:RadButton.Content>
                                </telerik:RadButton>
                                <sdk:Label Content="{Binding Kosten, StringFormat=\{0:#\,##0\}}" Margin="5,0,0,0" />
                                <sdk:Label Content="€" Margin="3,0,0,0" />
                            </StackPanel>
                        </Grid>
                    </telerik:RadPanelBarItem.Header>
  
                    <Grid Background="{StaticResource WhiteBackground}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="83*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="83*" />
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
  
                        <sdk:Label Content="Naam" Margin="3" />
                        <TextBox Text="{Binding Naam, Mode=TwoWay}"  Grid.Column="1" Margin="0,3,3,3" HorizontalAlignment="Right" Width="130" />
  
                        <sdk:Label Content="Omschrijving" Grid.Row="1" Margin="3" />
                        <TextBox Text="{Binding Omschrijving, Mode=TwoWay}" Grid.Column="1" Margin="3" Grid.Row="1" Style="{StaticResource omschrijvingTextBox}" Width="130" HorizontalAlignment="Right" />
  
                        <sdk:Label Content="Bedrag" Grid.Row="2" Margin="3" />
                        <TextBox Text="{Binding Expressie, Mode=TwoWay}" Grid.Column="1" Margin="0,3,21,3"  Grid.Row="2" Tag="Expression" HorizontalAlignment="Right" Width="112" />
                        <telerik:RadButton Width="20" Content="..." Grid.Column="1" Grid.Row="2" Margin="3" Click="BtnExpression_Click"  HorizontalAlignment="Right" CommandParameter="{Binding Id}" ToolTipService.ToolTip="Calculator"></telerik:RadButton>
  
                        <telerik:RadExpander Grid.Row="3" Header="Geavanceerd" Grid.ColumnSpan="2" Padding="0,5,0,0" Margin="0,3,0,0" Grid.RowSpan="2">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="135*" />
                                    <ColumnDefinition Width="136" />
                                </Grid.ColumnDefinitions>
  
                                <sdk:Label Content="Index" Grid.Column="0" Grid.Row="0" Margin="3" />
                                <telerik:RadComboBox Margin="3" Height="26" Grid.Column="1" SelectedValue="{Binding Path=PeilCategorieId, Mode=TwoWay}"
                                                     SelectedValuePath="IndexCategorieId"
                                                     DisplayMemberPath="IndexCategorieNaam"
                                                    ItemsSource="{Binding Path=Parent.Parent.IndexCategorien}" />
  
                                <sdk:Label Content="Jaar" Grid.Row="1" Grid.Column="0" Margin="3" />
                                <telerik:RadComboBox Margin="3" Height="26" Grid.Column="1" Grid.Row="1"
                                                    SelectedValue="{Binding Path=PeilJaar, Mode=TwoWay}"
                                                    ItemsSource="{Binding Path=Parent.Parent.PrijsPeilJaren}" />
  
                                <sdk:Label Content="Maand" Grid.Row="2" Grid.Column="0" Margin="3" />
                                  
                                <telerik:RadComboBox Margin="3" Height="26" Grid.Column="1" Grid.Row="2"                                                   
                                                    ItemsSource="{Binding Path=Parent.Parent.Maanden}" />
  
                                <sdk:Label Content="Verdeling" Margin="3,3,30,3" Grid.Row="3" />
  
                                <telerik:RadComboBox Margin="3" Height="26" Grid.Column="1" Grid.Row="3"
                                                    SelectedItem="{Binding VerdeelAlgoritme, Mode=TwoWay}"
                                                    ItemsSource="{Binding Source={StaticResource KavelVerdelingSource}, Path=Values}"/>
  
                            </Grid>
                        </telerik:RadExpander>
  
  
                        <Border Grid.Row="5" Grid.ColumnSpan="2" Margin="3" Background="{StaticResource HeaderLightBlue}" BorderBrush="White" BorderThickness="1" CornerRadius="1">
                            <telerik:RadButton Name="btnSave" Click="btnSave_Click" Style="{StaticResource ButtonOpslaanStyle}" Margin="2" HorizontalAlignment="Right" />
                        </Border>
                    </Grid>
                </telerik:RadPanelBarItem>
            </telerik:RadPanelBar>
  
        </telerik:HierarchicalDataTemplate>
  
        <telerik:HierarchicalDataTemplate x:Key="PanelBarHeaderTemplate" ItemsSource="{Binding Path=KostenRegels}" ItemTemplate="{StaticResource DetailsTemplate}">
            <Grid x:Name="LayoutRoot" Background="Transparent">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="163*" />
                    <ColumnDefinition Width="102*" />
                </Grid.ColumnDefinitions>
  
                <sdk:Label Content="{Binding Naam, Mode=TwoWay}" Margin="5,0,0,0" />
  
                <StackPanel Grid.Column="1" Orientation="Horizontal" FlowDirection="RightToLeft">
                    <Button Name="btnInsertKostenRegel" Click="btnInsertKostenRegel_Click" CommandParameter="{Binding Id}" ToolTipService.ToolTip="Post toevoegen">
                        <Button.Content>
                            <Image Source="/Brink%20Interface;component/Assets/Icons/add.png" Height="14" Width="14" />
                        </Button.Content>
                    </Button>
  
                    <sdk:Label Content="{Binding TotaleKosten, Mode=OneWay, StringFormat=\{0:#\,##0\}}"  Margin="5,0,0,0" />
                    <sdk:Label Content="€" Margin="3,0,0,0" />
                </StackPanel>
            </Grid>
        </telerik:HierarchicalDataTemplate>
    </UserControl.Resources>
  
    <telerik:RadBusyIndicator Name="buzyIndicator" IsBusy="False" IsIndeterminate="True" DisplayAfter="00:00:00" BusyContent="Laden...">
        <Grid x:Name="LayoutRoot" Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <paladinContainerControls:InputTabControl x:Name="tbCtrl" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Top" Grid.Row="0">
                <paladinContainerControls:InputTabControl.InformationContent>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" /> 
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100*" />
                            <ColumnDefinition Width="180" />
                        </Grid.ColumnDefinitions>
  
                        <sdk:Label Grid.Column="0" Grid.Row="0" Margin="3" Content="Naam" />
                        <sdk:Label Grid.Column="1" Grid.Row="0" Margin="3" Content="{Binding Path=Naam}" />
  
                        <sdk:Label Grid.Column="0" Grid.Row="1" Margin="3" Content="Oppervlakte"/>
                        <sdk:Label Grid.Column="1" Grid.Row="1" Margin="3" Content="{Binding Path=Oppervlakte}" />
                          
                        <sdk:Label Grid.Column="0" Grid.Row="2" Margin="3" Content="Deelgebieden"/>
                        <sdk:Label Grid.Column="1" Grid.Row="2" Margin="3" Content="{Binding Path=AantalDeelgebieden}" />
                          
                        <sdk:Label Grid.Column="0" Grid.Row="3" Margin="3" Content="Kavels"/>
                        <sdk:Label Grid.Column="1" Grid.Row="3" Margin="3" Content="{Binding Path=AantalKavels}" />
  
                        <sdk:Label Grid.Column="0" Grid.Row="4" Margin="3" Content="Vastgoed"/>
                        <sdk:Label Grid.Column="1" Grid.Row="4" Margin="3" Content="{Binding Path=AantalVastgoedObjecten}"/>
                        <telerik:RadExpander Grid.Row="5" Header="Ruimtegebruik" 
                           x:Name="radExpander5" ExpandDirection="Down" Padding="5" IsExpanded="True" Grid.ColumnSpan="2">
                            <paladinSubControls:RuimteGebruikDisplayView x:Name="ruimteGebruikDisplayView"></paladinSubControls:RuimteGebruikDisplayView>
                        </telerik:RadExpander>
                    </Grid>
  
                </paladinContainerControls:InputTabControl.InformationContent>
                <paladinContainerControls:InputTabControl.FinancialContent>
                    <StackPanel>
                        <telerik:RadExpander Header="Grondkosten" ExpandDirection="Down" IsExpanded="True" Background="{StaticResource WhiteBackground}" Padding="5">
                            <Grid Background="Transparent">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <StackPanel Orientation="Vertical">
                                <telerik:RadPanelBar x:Name="pnlKosten" ItemsSource="{Binding Path=Grondkosten.KostenSoorten, Mode=TwoWay}" ItemTemplate="{StaticResource PanelBarHeaderTemplate}" ExpandMode="Multiple">
                                </telerik:RadPanelBar>
                                <telerik:RadPanelBar x:Name="pnlTotal"  Background="Transparent">
                                      
                                    <telerik:RadPanelBarItem IsDropAllowed="False" >
                                            <telerik:RadPanelBarItem.Header>
                                                <Grid x:Name="layoutHeader" Background="Transparent">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="163*" />
                                                        <ColumnDefinition Width="102*" />
                                                    </Grid.ColumnDefinitions>
  
                                                    <sdk:Label Content="Totale Kosten" Margin="5,0,0,0" />
                                                    <StackPanel Grid.Column="1" Orientation="Horizontal" FlowDirection="RightToLeft">
                                                                       
  
                                                        <sdk:Label Margin="25,0,0,0" Content="{Binding Path=Grondkosten.Totaal, Mode=OneWay, StringFormat=\{0:#\,##0\}}"   />
                                                        <sdk:Label Content="€" Margin="3,0,0,0" />
                                                    </StackPanel>
                                                </Grid>
                                            </telerik:RadPanelBarItem.Header>
                                        </telerik:RadPanelBarItem>
                                </telerik:RadPanelBar>
                                </StackPanel>
                            </Grid>
                        </telerik:RadExpander>
                        <!--
                        <Rectangle Height="1" Fill="{StaticResource DarkBorder}"/>
                        <telerik:RadExpander Header="Grond Opbrengsten" x:Name="radExpander4" Background="Transparent">
                            <Grid  Background="Transparent"/>
                        </telerik:RadExpander>
                        <Rectangle Height="1" Fill="{StaticResource DarkBorder}"/>
                        -->
                    </StackPanel>
                </paladinContainerControls:InputTabControl.FinancialContent>
            </paladinContainerControls:InputTabControl>
        </Grid>
    </telerik:RadBusyIndicator>
</local:DataControl>
0
Jonam
Top achievements
Rank 1
answered on 16 Mar 2011, 12:13 PM
<telerik:RadComboBox Margin="3" Height="26" Grid.Column="1" Grid.Row="3"
                                                    SelectedItem="{Binding VerdeelAlgoritme, Mode=TwoWay}"
                                                    ItemsSource="{Binding Source={StaticResource KavelVerdelingSource}, Path=Values}"/>



the above sample is the total code. If i remove this part then everything works fine. Any ideas?
0
Yana
Telerik team
answered on 21 Mar 2011, 09:54 AM
Hi Jonam,

I'm afraid that we're still not able to reproduce the issue. Could you please open a support ticket and attach a runnable project demonstrating the problem there. Thanks in advance

Best wishes,
Yana
the Telerik team
Tags
ComboBox
Asked by
Jonam
Top achievements
Rank 1
Answers by
Yana
Telerik team
Jonam
Top achievements
Rank 1
Jonam
Top achievements
Rank 1
Share this question
or