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

VS2017 - Object does not match target type

1 Answer 279 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Vivian
Top achievements
Rank 1
Vivian asked on 01 Jun 2017, 11:45 AM

XAML editor complains “Object does not match target type” while using the RibbonView. I have the latest updated VS2017. 

I have tried using the threads on StackOverflow.

https://stackoverflow.com/questions/14591781/object-does-not-match-target-type

https://stackoverflow.com/questions/31815177/design-mode-error-object-does-not-match-target-type-for-loaded-page-resource

https://stackoverflow.com/questions/31726759/xaml-editor-complains-object-does-not-match-target-type-for-sharedresourcedict

I was not able to resolve my error using them links. The source compiles and runs but the editor complains and it is irritating and obstructing actual errors. 

<telerik:RadRibbonView Grid.Row="0" x:Name="RibbonView" ApplicationName="MyApplication" Title="{x:Static properties:Resources.RibbonViewTitle}"
                               ApplicationButtonImageSource="../Images/MyApp.png"
                               MinimizeButtonVisibility="Visible">
            <!--Need to add HelpRequested Event Handler using MVVM-->
            <telerik:RadRibbonView.TabStripAdditionalContent>
                <StackPanel Orientation="Horizontal">
                    <TextBlock x:Name="Vers" VerticalAlignment="Center" Margin="2,0,5,0"></TextBlock>
                </StackPanel>
            </telerik:RadRibbonView.TabStripAdditionalContent>
            <telerik:RadRibbonView.QuickAccessToolBar>
                <telerik:QuickAccessToolBar>
                    <telerik:RadRibbonButton Text="{x:Static properties:Resources.FileMenuSave}" SmallImage="../Images/Save_sm.png"
                                             Size="Small" telerik:KeyTipService.AccessText="1" Command="{Binding Path=SaveWorkflowCommand}" />
                    <telerik:RadRibbonButton Text="Undo" SmallImage="../Images/Undo_sm.png"
                                             Size="Small" telerik:KeyTipService.AccessText="2" Command="ApplicationCommands.Undo" />
                    <telerik:RadRibbonButton Text="Redo" SmallImage="../Images/Redo_sm.png"
                                             Size="Small" telerik:KeyTipService.AccessText="3" Command="ApplicationCommands.Redo" />
                </telerik:QuickAccessToolBar>
            </telerik:RadRibbonView.QuickAccessToolBar>
            <telerik:RadRibbonView.ApplicationMenu>
                <telerik:ApplicationMenu>
                    <telerik:RadRibbonButton Text="{x:Static properties:Resources.FileMenuNewWorkflow}" LargeImage="../Images/New_lg.png"
                                             Command="{Binding Path=NewWorkflowCommand}" />
                    <telerik:RadRibbonButton Text="{x:Static properties:Resources.FileMenuOpen}" LargeImage="../Images/Open_lg.png"
                                             Command="{Binding Path=OpenWorkflowCommand}"/>
                    <telerik:Separator />
                    <telerik:RadRibbonButton Text="{x:Static properties:Resources.FileMenuSave}" LargeImage="../Images/Save_lg.png"
                                             Command="{Binding Path=SaveWorkflowCommand}"/>
                    <telerik:RadRibbonButton Text="{x:Static properties:Resources.FileMenuSaveAs}" LargeImage="../Images/SaveAs_lg.png"
                                             Command="{Binding Path=SaveAsWorkflowCommand}"/>
                    <telerik:RadRibbonButton Text="{x:Static properties:Resources.FileMenuSaveAll}" LargeImage="../Images/SaveAs_lg.png"
                                             Command="{Binding Path=SaveAllWorkflowsCommand}"/>
                    <telerik:Separator />
                    <telerik:RadRibbonButton Text="Import XML" LargeImage="../Images/Import_lg.png"/>
                    <telerik:RadRibbonButton Text="{x:Static properties:Resources.DebugMenuStartWithoutDebugging}" LargeImage="../Images/Start_lg.png"
                                             Command="{Binding Path=StartWithoutDebuggingCommand}"/>
                    <telerik:Separator />
                    <telerik:RadRibbonButton Text="Copy Variables" LargeImage="../Images/Variables_lg.png"/>
                    <telerik:Separator />
                    <telerik:RadRibbonButton Text="Manage Extensions" LargeImage="../Images/Import_lg.png"
                                             />
                    <telerik:Separator />
                    <telerik:RadRibbonButton Text="Encrypt Value" LargeImage="../Images/encrypt_lg.png"
                                             />
                    <telerik:Separator />
                    <telerik:ApplicationMenu.FooterContent>
                        <StackPanel Height="25"
                                    Orientation="Horizontal">
                            <telerik:RadButton Width="86"
                                               Height="22"
                                               Margin="3 0 2 0">
                                <telerik:RadButton.Content>
                                    <StackPanel Orientation="Horizontal"
                                                VerticalAlignment="Center"
                                                Margin="3 0  5 0">
                                        <Image Width="16"
                                               Height="16" Source="../Images/Exit_sm.png" />
                                        <TextBlock Margin="4 0 0 0"
                                                   VerticalAlignment="Center"
                                                   Text="Exit" />
                                    </StackPanel>
                                </telerik:RadButton.Content>
                            </telerik:RadButton>
                        </StackPanel>
                    </telerik:ApplicationMenu.FooterContent>
                </telerik:ApplicationMenu>
            </telerik:RadRibbonView.ApplicationMenu>
            <telerik:RadRibbonView.Items>
                <telerik:RadRibbonTab Header="{x:Static properties:Resources.HomeMenu}">
                    <telerik:RadRibbonGroup Header="{x:Static properties:Resources.FileMenu}" telerik:KeyTipService.AltAccessText="F">
                        <telerik:RadRibbonButton x:Name="RibGrpNew" LargeImage="../Images/New_lg.png" Size="Large"
                                                 Text="{x:Static properties:Resources.FileMenuNewWorkflow}" telerik:KeyTipService.AccessText="N" Command="{Binding Path=NewWorkflowCommand}" ToolTip="Ctrl+N" />
                        <telerik:RadCollapsiblePanel>
                            <telerik:RadRibbonButton x:Name="RibGrpOpen"
                                                     LargeImage="../Images/Open_lg.png" Size="Large"
                                                     Text="{x:Static properties:Resources.FileMenuOpen}" telerik:KeyTipService.AccessText="O" Command="{Binding Path=OpenWorkflowCommand}" />
                        </telerik:RadCollapsiblePanel>
                        <StackPanel>
                            <telerik:RadRibbonButton x:Name="RibGrpSave"
                                                     SmallImage="../Images/Save_lg.png" Size="Medium"
                                                     Text="{x:Static properties:Resources.FileMenuSave}" telerik:KeyTipService.AccessText="S" Command="{Binding Path=SaveWorkflowCommand}" />
                            <telerik:RadRibbonButton x:Name="RibGrpSaveAs"
                                                     SmallImage="../Images/SaveAs_lg.png" Size="Medium"
                                                     Text="{x:Static properties:Resources.FileMenuSaveAs}" telerik:KeyTipService.AccessText="SA" Command="{Binding Path=SaveAsWorkflowCommand}" />
                        </StackPanel>
                    </telerik:RadRibbonGroup>
                    <telerik:RadRibbonGroup x:Name="RibGrpExec" Header="{x:Static properties:Resources.RibGrpExecHeader}" telerik:KeyTipService.AltAccessText="E">
                        <telerik:RadRibbonButton x:Name="RibGrpStart" LargeImage="../Images/Start_lg.png" Size="Large"
                                                 Text="{x:Static properties:Resources.DebugMenuStartWithoutDebugging}" Tag="0" telerik:KeyTipService.AccessText="ST" Command="{Binding Path=StartWithoutDebuggingCommand}">
                        </telerik:RadRibbonButton>
                        <telerik:RadRibbonButton x:Name="RibGrpStartWithVariable" Tag="1" LargeImage="../Images/StartVar_lg.png" Size="Large"
                                                 Text="Start with variable" telerik:KeyTipService.AccessText="ST" Command="{Binding Path=StartWithoutDebuggingCommand}">
                        </telerik:RadRibbonButton>
                        <telerik:RadCollapsiblePanel>
                            <telerik:RadRibbonButton x:Name="RibGrpStop"
                                                     LargeImage="../Images/Stop_lg.png" Size="Large"
                                                     Text="{x:Static properties:Resources.DebugMenuAbort}" Command="{Binding Path=AbortCommand}" ToolTip="F5" />
                        </telerik:RadCollapsiblePanel>
                        <StackPanel>
                            <telerik:RadRibbonButton x:Name="RunDebug"
                                                     SmallImage="../Images/Debug_sm.png" Size="Medium"
                                                     Text="{x:Static properties:Resources.DebugMenuStartDebugging}" telerik:KeyTipService.AccessText="DG" Command="{Binding Path=StartWithDebuggingCommand}" />
                            <telerik:RadRibbonButton x:Name="RunVerbose"
                                                     SmallImage="../Images/Debug_sm.png" Size="Medium"
                                                     Text="Verbose_Logging" telerik:KeyTipService.AccessText="DG"/>
                        </StackPanel>
                    </telerik:RadRibbonGroup>
                </telerik:RadRibbonTab>
                <telerik:RadRibbonTab Header="{x:Static properties:Resources.ViewMenu}" />
                <telerik:RadRibbonTab Header="{x:Static properties:Resources.DebugMenu}" />
                <telerik:RadRibbonTab Header="{x:Static properties:Resources.HelpMenu}" />
            </telerik:RadRibbonView.Items>
        </telerik:RadRibbonView>

Any help or suggestion is appreciated. 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 06 Jun 2017, 12:25 PM
Hello,

I ran the snippet in VS2017 Professional without success of reproducing the issue. Could I ask you to provide a runnable sample project that isolates the issue, since I assume that clearing all the bindings and static setters might have prevented the issue from occurring).

Furthermore, I could suggest closing the studio, cleaning the bin and obj folders and their contents, and rebuilding, and/or checking if the types of the static properties that are set to the controls meet the expected types for the properties - i.e. if the Title of the RadRibbonView is a string etc.

Regards,
Martin
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RibbonView and RibbonWindow
Asked by
Vivian
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or