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

Ambigious type reference error & FilteringControl style

3 Answers 114 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Shaun
Top achievements
Rank 1
Shaun asked on 18 Nov 2011, 08:35 PM
I just added a style to my app (in appStyles.xaml) to hide the gridview distinct filter. The style is working but in design view of pages & windows i get the following errors:



This is what the resource declarations in the appStyles.xaml are:

 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br>    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"<br>    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"<br>    xmlns:Telerik_Windows_Controls_MaskedTextBox="clr-namespace:Telerik.Windows.Controls.MaskedTextBox;assembly=Telerik.Windows.Controls.Input"  >

Here's how i'm the style for the FilteringControl:
    <Style TargetType="{x:Type telerik:FilteringControl}" ><br>        <Setter Property="Template"><br>            <Setter.Value><br>                <ControlTemplate TargetType="{x:Type telerik:FilteringControl}"><br>                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1" Margin="{TemplateBinding Margin}"><br>                        <Border BorderBrush="White" BorderThickness="1" Background="{TemplateBinding Background}"><br>                            <Grid><br>                                <StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" MaxWidth="350" Margin="{TemplateBinding Padding}" MinWidth="200" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"><br>                                    <StackPanel x:Name="PART_DistinctFilter" Visibility="{TemplateBinding DistinctFiltersVisibility}"><br>                                        <CheckBox x:Name="PART_SelectAllCheckBox" Visibility="Collapsed" Content="Select All" IsChecked="{Binding SelectAll, Mode=TwoWay}" Margin="0,2" telerik:LocalizationManager.ResourceKey="GridViewFilterSelectAll"><br>                                            <telerik:StyleManager.Theme><br>                                                <telerik:MetroTheme /><br>                                            </telerik:StyleManager.Theme><br>                                        </CheckBox><br>                                        <ListBox x:Name="PART_DistinctValuesList" ItemsSource="{Binding DistinctValues}" ScrollViewer.HorizontalScrollBarVisibility="Auto" <br>                                                     MaxHeight="100" SelectionMode="Multiple" Visibility="Collapsed" ><br>                                            <ListBox.ItemTemplate><br>                                                <DataTemplate><br>                                                    <CheckBox Content="{Binding ConvertedValue}" IsChecked="{Binding IsActive, Mode=TwoWay}" VerticalContentAlignment="Center"><br>                                                        <telerik:StyleManager.Theme><br>                                                            <telerik:MetroTheme/><br>                                                        </telerik:StyleManager.Theme><br>                                                    </CheckBox><br>                                                </DataTemplate><br>                                            </ListBox.ItemTemplate><br>                                            <telerik:StyleManager.Theme><br>                                                <telerik:MetroTheme/><br>                                            </telerik:StyleManager.Theme><br>                                        </ListBox><br>                                    </StackPanel><br>                                    <StackPanel Margin="0,2" Visibility="{TemplateBinding FieldFiltersVisibility}"><br>                                        <TextBlock Margin="0,2,0,0" telerik:LocalizationManager.ResourceKey="GridViewFilterShowRowsWithValueThat" Text="Show rows with value that"></TextBlock><br>                                        <telerik:RadComboBox x:Name="PART_Filter1ComboBox" ItemsSource="{Binding AvailableActions}" SelectedItem="{Binding Filter1.Operator, Mode=TwoWay}"  Margin="0,2"><br>                                            <telerik:RadComboBox.ItemTemplate><br>                                                <DataTemplate><br>                                                    <TextBlock><br>                                                       <TextBlock.Text><br>                                                        <Binding><br>                                                         <Binding.Converter><br>                                                          <telerik:FilterOperatorConverter/><br>                                                         </Binding.Converter><br>                                                        </Binding><br>                                                       </TextBlock.Text><br>                                                    </TextBlock><br>                                                </DataTemplate><br>                                            </telerik:RadComboBox.ItemTemplate><br>                                            <telerik:StyleManager.Theme><br>                                                <telerik:MetroTheme/><br>                                            </telerik:StyleManager.Theme><br>                                        </telerik:RadComboBox><br>                                        <ContentControl x:Name="PART_Filter1ContentControl" DataContext="{Binding Filter1}" HorizontalContentAlignment="Stretch" Margin="0,2" VerticalContentAlignment="Stretch"/><br>                                        <telerik:RadComboBox x:Name="PART_LogicalOperatorsComboBox"  ItemsSource="{Binding LogicalOperators}" SelectedItem="{Binding FieldFilterLogicalOperator, Mode=TwoWay}" Margin="0,2"><br>                                            <telerik:RadComboBox.ItemTemplate><br>                                                <DataTemplate><br>                                                    <TextBlock><br>                                                       <TextBlock.Text><br>                                                        <Binding><br>                                                         <Binding.Converter><br>                                                          <telerik:FilterCompositionLogicalOperatorConverter/><br>                                                         </Binding.Converter><br>                                                        </Binding><br>                                                       </TextBlock.Text><br>                                                    </TextBlock><br>                                                </DataTemplate><br>                                            </telerik:RadComboBox.ItemTemplate><br>                                            <telerik:StyleManager.Theme><br>                                                <telerik:MetroTheme/><br>                                            </telerik:StyleManager.Theme><br>                                        </telerik:RadComboBox><br>                                        <telerik:RadComboBox x:Name="PART_Filter2ComboBox" ItemsSource="{Binding AvailableActions}"  SelectedItem="{Binding Filter2.Operator, Mode=TwoWay}"  Margin="0,2"><br>                                            <telerik:RadComboBox.ItemTemplate><br>                                                <DataTemplate><br>                                                    <TextBlock><br>                                                       <TextBlock.Text><br>                                                        <Binding><br>                                                         <Binding.Converter><br>                                                          <telerik:FilterOperatorConverter/><br>                                                         </Binding.Converter><br>                                                        </Binding><br>                                                       </TextBlock.Text><br>                                                    </TextBlock><br>                                                </DataTemplate><br>                                            </telerik:RadComboBox.ItemTemplate><br>                                            <telerik:StyleManager.Theme><br>                                                <telerik:MetroTheme/><br>                                            </telerik:StyleManager.Theme><br>                                        </telerik:RadComboBox><br>                                        <ContentControl x:Name="PART_Filter2ContentControl" DataContext="{Binding Filter2}" HorizontalContentAlignment="Stretch" Margin="0,2" VerticalContentAlignment="Stretch"/><br>                                    </StackPanel><br>                                    <Grid><br>                                        <Grid.ColumnDefinitions><br>                                            <ColumnDefinition/><br>                                            <ColumnDefinition/><br>                                        </Grid.ColumnDefinitions><br>                                        <Button x:Name="PART_ApplyFilterButton" Content="Filter" Grid.Column="0" Height="22" Margin="0,2,2,2" telerik:LocalizationManager.ResourceKey="GridViewFilter"><br>                                            <telerik:StyleManager.Theme><br>                                                <telerik:MetroTheme/><br>                                            </telerik:StyleManager.Theme><br>                                        </Button><br>                                        <Button x:Name="PART_ClearFilterButton" Content="Clear Filter" Grid.Column="1" Height="22" Margin="2,2,0,2" telerik:LocalizationManager.ResourceKey="GridViewClearFilter"><br>                                            <telerik:StyleManager.Theme><br>                                                <telerik:MetroTheme/><br>                                            </telerik:StyleManager.Theme><br>                                        </Button><br>                                    </Grid><br>                                </StackPanel><br>                                <telerik:RadButton x:Name="PART_FilterCloseButton" HorizontalAlignment="Right" Height="13" Margin="{TemplateBinding Padding}" VerticalAlignment="Top" Width="13"><br>                                    <telerik:StyleManager.Theme><br>                                        <telerik:MetroTheme/><br>                                    </telerik:StyleManager.Theme><br>                                    <Path Data="M4,4L5,4 5,5 4,5z M0,4L1,4 1,5 0,5z M3,3L4,3 4,4 3,4z M1,3L2,3 2,4 1,4z M2,2L3,2 3,3 2,3z M4,0L5,0 5,1 4,1 4,2 3,2 3,0.99999994 4,0.99999994z M0,0L1,0 1,0.99999994 2,0.99999994 2,2 1,2 1,1 0,1z" Fill="Black" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Height="6" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="6"/><br>                                </telerik:RadButton><br>                            </Grid><br>                        </Border><br>                    </Border><br>                </ControlTemplate><br>            </Setter.Value><br>        </Setter><br>        <Setter Property="Background" Value="#FFE4E4E4"/><br>        <Setter Property="BorderBrush" Value="#FF848484"/><br>        <Setter Property="Padding" Value="5"/><br>        <Setter Property="Margin" Value="0,2,0,0"/><br>        <Setter Property="BorderThickness" Value="1"/><br>        <Setter Property="VerticalContentAlignment" Value="Stretch"/><br>        <Setter Property="HorizontalContentAlignment" Value="Stretch"/><br>        <Setter Property="Foreground" Value="Black"/><br>        <Setter Property="SnapsToDevicePixels" Value="True"/><br>    </Style>

Here's from a window:
<Window x:Class="RawDataView" <br>    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br>    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br>    Title="Raw Data View" Height="437" Width="658" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" WindowStartupLocation="CenterOwner"><br><br>    <Window.Resources><br>            <ResourceDictionary><br>                <!--Set this here due to Telerik bug, so header cell and row colors match--><br>                <Style x:Key="headerRow" TargetType="telerik:GridViewHeaderRow"><br>                    <Setter Property="Background" Value="#FFF5F5FD"/><br>                </Style><br>            <!-- Import our app styles --><br>            <ResourceDictionary.MergedDictionaries><br>                <ResourceDictionary Source="/app.Styles.xaml" /><br>            </ResourceDictionary.MergedDictionaries><br>        </ResourceDictionary><br>    </Window.Resources>

Not sure if i need to qualify the FilteringControl style with something or add another xmlns reference to the styles. Thanks

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 21 Nov 2011, 08:42 AM
Hello Nk,

 

Thank you for sharing this snippet with us! I have just checked the modified FilteringControl style, however everything works fine by my side. Will you please check the attached project and let me know how it differs from yours? If the problem still persists feel free to modify it and send it back to us in a new support ticket where we can see what might be wrong. 





Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Shaun
Top achievements
Rank 1
answered on 21 Nov 2011, 03:45 PM
Vanya, thanks for the response and example project. The only difference i can see is that my solution is targeting the 3.5 .net framework and yours is 4.0. Could that be the issue? Is there something i need in addition to compensate for the different framework? Thanks again.
0
Vanya Pavlova
Telerik team
answered on 21 Nov 2011, 04:04 PM
Hi Nk,

 

Indeed the problem is related to the target framework in your project! I suggest that for flexibility you have replaced the grid prefix with the Telerik schema (telerik:), however under WPF 3.5 you should use the initial one and the full namespace in order to avoid such errors, something like the following:

xmlns:grid="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
 
<grid:FilterOperatorConverter/>

Furthermore I have updated the previous project and now everything works as expected in WPF 3.5.


All the best,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Shaun
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Shaun
Top achievements
Rank 1
Share this question
or