I am getting the above error trying to implement one of your WPF examples.
Please can you tell me where I am going wrong.
I am trying to implement a simple Carousel.
Muy code is ...
<Window x:Class="frmMain" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
Title="dareSOFT OST2PST Conversion Utility" Height="300" Width="402" MinWidth="402" MinHeight="300" xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"> |
<Grid> |
<my:RadCarousel Name="rcMenu" AutoGenerateDataPresenters="True" HorizontalAlignment="Stretch" Cursor="Arrow"> |
<my:RadCarousel.BitmapEffectInput> |
<BitmapEffectInput /> |
</my:RadCarousel.BitmapEffectInput> |
<my:RadCarousel.BitmapEffect> |
<BlurBitmapEffect /> |
</my:RadCarousel.BitmapEffect> |
<Style TargetType="{my:Type telerik:CarouselDataRecordPresenter}"> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{my:Type telerik:CarouselDataRecordPresenter}"> |
<Grid IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
<Grid.RowDefinitions> |
<RowDefinition Height="30" /> |
<RowDefinition Height="100" /> |
<RowDefinition Height="Auto" /> |
</Grid.RowDefinitions> |
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" > |
<Label Content="{Binding Path=Fields[Text].Value}" FontSize="12" Foreground="#ff8FB3FF"/> |
</StackPanel> |
<Rectangle Grid.Row="1" RadiusX="3" RadiusY="3" Width="110" Height="80"> |
<Rectangle.Fill> |
<ImageBrush x:Name="brush" ImageSource="{Binding Path=Fields[Picture].Value}"/> |
</Rectangle.Fill> |
</Rectangle> |
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center"> |
<Label Content="{Binding Path=Fields[Text].Value}" FontSize="12" Foreground="#ff8FB3FF"/> |
</StackPanel> |
</Grid> |
</ControlTemplate> |
</Setter.Value> |
</Setter> |
</Style> |
</my:RadCarousel> |
</Grid> |
</Window> |
Kind Regards
David
13 Answers, 1 is accepted
The only change that you have to make to fix this problem is to use "x:Type" instead of "my:Type". This is needed as the so called Type markup extension is defined in the "http://schemas.microsoft.com/winfx/2006/xaml" namespace and when you use "my:Type" the compiler searches for this extension in the wrong place.
Hope this helps.
Regards,
Milan
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I have now replaced "my" with "x".
I now get the error: Could not create an instance of type 'TypeExtension'.
This occurrs on line ...
ObjectType="{x:Type e:dareSOFT_OST2PSTDataSet}" |
If I remove this line then the error occurs on this line ...
<Style TargetType="{x:Type telerik:CarouselDataRecordPresenter}"> |
My entire code at present looks like ...
<Window x:Class="frmMain" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
Title="dareSOFT OST2PST Conversion Utility" Height="300" Width="402" MinWidth="402" MinHeight="300" xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"> |
<Grid> |
<Grid.Resources> |
<ObjectDataProvider x:Key="objectDataProvider" ObjectType="{x:Type e:dareSOFT_OST2PSTDataSet}" MethodName="GetCustomersView" /> |
</Grid.Resources> |
<my:RadCarousel Name="rcMenu" AutoGenerateDataPresenters="True" HorizontalAlignment="Stretch" Cursor="Arrow" ItemsSource="{Binding Source={StaticResource objectDataProvider}}"> |
<my:RadCarousel.BitmapEffectInput> |
<BitmapEffectInput /> |
</my:RadCarousel.BitmapEffectInput> |
<my:RadCarousel.BitmapEffect> |
<BlurBitmapEffect /> |
</my:RadCarousel.BitmapEffect> |
<Style TargetType="{x:Type telerik:CarouselDataRecordPresenter}"> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{x:Type telerik:CarouselDataRecordPresenter}"> |
<Grid IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
<Grid.RowDefinitions> |
<RowDefinition Height="30" /> |
<RowDefinition Height="100" /> |
<RowDefinition Height="Auto" /> |
</Grid.RowDefinitions> |
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" > |
<Label Content="{Binding Path=Fields[Text].Value}" FontSize="12" Foreground="#ff8FB3FF"/> |
</StackPanel> |
<Rectangle Grid.Row="1" RadiusX="3" RadiusY="3" Width="110" Height="80"> |
<Rectangle.Fill> |
<ImageBrush x:Name="brush" ImageSource="{Binding Path=Fields[Picture].Value}"/> |
</Rectangle.Fill> |
</Rectangle> |
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center"> |
<Label Content="{Binding Path=Fields[Text].Value}" FontSize="12" Foreground="#ff8FB3FF"/> |
</StackPanel> |
</Grid> |
</ControlTemplate> |
</Setter.Value> |
</Setter> |
</Style> |
</my:RadCarousel> |
</Grid> |
</Window> |
Any ideas
Kind Regards
David
I have created a sample project that will get you started on creating custom styles for the CarouselDataRecordPresenter. Here I will briefly mention the solutions to the compilation problems that you are having. First the "e" namespace mapping is not defined and when you try to set the ObjectType property of your objectDataProvider to "{x:Type e:dareSOFT_OST2PSTDataSet}" the "dareSOFT_OST2PSTDataSet" cannot be located. The last change that you need to do is to move your style definition to the "Grid.Resources" section.
Feel free to check out the sample project where you can find a detailed explanation.
Best wishes,
Milan
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I have created same WPF Browser Application, In that I have used the same code given in your example. Changed the namespace. added DataClass.cs and sky.png.
but when i run this application I could see only blank items moving in carousel. Can someone tell me where i did mistake?
my code in xaml is
<Page x:Class="tryWpf2.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:e="clr-namespace:tryWpf2"
Title="Page1">
<Grid>
<Grid.Resources>
<ObjectDataProvider x:Key="objectDataProvider" ObjectType="{x:Type e:DataClass}" MethodName="GetSampleData"/>
<Style TargetType="{x:Type telerik:CarouselDataRecordPresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type telerik:CarouselDataRecordPresenter}">
<Grid IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="100" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" >
<Label Content="{Binding Path=Fields[Text].Value}" FontSize="12" Foreground="#ff8FB3FF"/>
</StackPanel>
<Rectangle Grid.Row="1" RadiusX="3" RadiusY="3" Width="110" Height="80">
<Rectangle.Fill>
<ImageBrush x:Name="brush" ImageSource="{Binding Path=Fields[Picture].Value}"/>
</Rectangle.Fill>
</Rectangle>
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center">
<Label Content="{Binding Path=Fields[Text].Value}" FontSize="12" Foreground="#ff8FB3FF"/>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<telerik:RadCarousel Name="radCarousel1" ItemsSource="{Binding}" DataContext="{StaticResource objectDataProvider}" />
</Grid>
</Page>
Regards
Vandana
The only thing that comes to my mind is to check the properties of sky.png. Its build actuion should be none and its copy to output should be set to always.
If that does not help could you please send us your applications so we can check it ourselves.
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
As per your suggestions I have set properties of sky.png. Its build action to none and its copy to output set to always.
Still It is showing blank CarouselItems. One more question is if the problem is with image it should at least show the data other than image ie two text that i am showing in Carousel Item.
When I run your sample project it runs successfully. but same code when I run in some trial application, It shows nothing. then what I am missing here
Also I am not able to upload my application. can you tell me how can I upload zip file to the forum?
Thanx and Regards
Vandana
Attachments in forums are not permitted - you can submit support ticket.
Kind regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
And from where I can submit support ticket?
Regards
Vandana
To open a support ticket, go to the Support page, scroll to the bottom of the page and click the "Send a support" ticket link.
Kind regards,
Hristo Deshev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
System.Windows.Data Error: 39 : BindingExpression path error: 'Fields' property not found on 'object' ''DataRecord' (HashCode=22895473)'. BindingExpression:Path=Fields[Text].Value; DataItem='DataRecord' (HashCode=22895473); target element is 'Label' (Name=''); target property is 'Content' (type 'Object')
System.Windows.Data Error: 39 : BindingExpression path error: 'Fields' property not found on 'object' ''DataRecord' (HashCode=38368963)'. BindingExpression:Path=Fields[Text].Value; DataItem='DataRecord' (HashCode=38368963); target element is 'Label' (Name=''); target property is 'Content' (type 'Object')
System.Windows.Data Error: 39 : BindingExpression path error: 'Fields' property not found on 'object' ''DataRecord' (HashCode=38368963)'. BindingExpression:Path=Fields[Text].Value; DataItem='DataRecord' (HashCode=38368963); target element is 'Label' (Name=''); target property is 'Content' (type 'Object')
Tried changing the BindingPath to Data[Text] and just Text but no luck. Checked references and they match your project.
Well, the binding expression error suggests that there is a binding that targets the Fields property of the DataRecord class. The Fields property has been deprecated and removed a long time ago. If you have updated to a newer version of our controls you should reconfigure your bindings.
For example, {Binding Path=Fields[FirstName]} should become {Binding Path=Data.FirstName}.
If that doesn't help could you be more specific about the example that you are refering to?
Could you paste the XAML code that is causing you problems so that we can fix the problem more easily?
Kind regards,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks,
David
I am glad that the problem is now resolved.
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.