I receive the following error at runtime when using the DataPresenter.
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=BtnImage'. BindingExpression:Path=ActualHeight; DataItem=null; target element is 'XamComboEditor' (Name=''); target property is 'Height' (type 'Double')
I am attempting to use the Metro theme but since it seems I cannot set "Theme" on the XamComboEditor in XAML I am using the Metro styles (including all required styles).
The issue seems to stem from DataPresenter but shows up regardless of if I include the DataPresenter styles or not. I started including these styles to rid myself of this error.
The error is not really impacting my application aside from throwing 3 binding errors which the user never sees. The error IS preventing me from performance profiling my application however.
Keep in mind that I get the error regardless of if the style files are included in my application. This is one of the source lines that apparently causes an issue:
From DataPresenterMetro.xaml in the FilterButtonStyleBase style:
<editors:XamComboEditor MinDropDownWidth="150" DropDownResizeMode="None" Opacity="0" ItemsSource="{Binding Operands, RelativeSource={RelativeSource TemplatedParent}}" SelectedItem="{Binding SelectedOperand, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsDropDownOpen="{Binding IsChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" MaxWidth="1" Height="{Binding ActualHeight, ElementName=BtnImage}"/>
I am using the XamDataPresenter and I've specified a CardView. I am not allowing record filtering and I have no fields that would be edited with a combobox.
Note: I also get the same error if I change my XamDataPresenter with a CardView to a XamDataCards control. Currently I'm not even including the theme XAML files in the project and I still get the same thing.
The only idea that I have currently to get rid of this error is to include all the theme XAML files again and remove the Height binding for the XamComboEditor.
Hello,
I have been looking into your post and the best approach in your scenario would be to set the ‘Theme’ property of the XamDataPresenter instead of adding DataPresenterMetro.xaml.
I am attaching a sample application(DataGridXAMLComboThemeIssue.zip) where the binding error does not appear.
Let me know, if you need any further assistance on this matter.
BTW: I get the same error if I use XamDataCards in place of the XamDataPresenter with a CardView.
I have logged this behavior with our developers in our tracking system, with an issue ID of 144406. I have also created a support ticket on your behalf with number CAS-118030-P8R2W0 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
I found a workaround. I am now referencing the following style files in my application:
<ResourceDictionary Source="Styles/Metro/DataPresenterGeneric_Brushes.xaml" /> <ResourceDictionary Source="Styles/Metro/DataPresenterGeneric_Express.xaml" /> <ResourceDictionary Source="Styles/Metro/DataPresenterGeneric.xaml" /> <ResourceDictionary Source="Styles/Metro/DataPresenterMetro_Brushes.xaml" /> <ResourceDictionary Source="Styles/Metro/DataPresenterMetro_Express.xaml" /> <ResourceDictionary Source="Styles/Metro/DataPresenterMetro.xaml" />
I am NOT using the Metro.xamDataPresenter.xaml file since it forces use of the style in the assembly (which has a problem). I fixed the problem in DataPresenterMetro.xaml and the solution is as follows:
In FilterButtonStyleBase in the Template setter, comment out the path element inside the CardPanel and add an AutoDisabledImage element named "BtnImage". The change is below, I am including the CardPanel and the XamComboEditor for context:
<igWindows:CardPanel IsHitTestVisible="False" Margin="{TemplateBinding Padding}"> <!--<Path Fill="{TemplateBinding Background}" Width="14" Height="10" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0,0 C0,0 11,0 11,0 11,0 7,4 7,4 7,4 7,8 7,8 7,8 4,8 4,8 4,8 4,4 4,4 4,4 0,0 0,0 z" Stretch="Fill"/>--> <igWindows:AutoDisabledImage x:Name="BtnImage" Stretch="None" igWindows:Utilities.SnapElementToDevicePixels="True" VerticalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding VerticalContentAlignment}"> <igWindows:AutoDisabledImage.Source> <BitmapImage UriSource="Images/Filter.png" /> </igWindows:AutoDisabledImage.Source> </igWindows:AutoDisabledImage>
<editors:XamComboEditor MinDropDownWidth="150" DropDownResizeMode="None" Opacity="0" ItemsSource="{Binding Operands, RelativeSource={RelativeSource TemplatedParent}}" SelectedItem="{Binding SelectedOperand, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsDropDownOpen="{Binding IsChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" MaxWidth="1" Height="{Binding ActualHeight, ElementName=BtnImage}"/> </igWindows:CardPanel>
You will notice that the Path element is commented out. Apologies for pasting XAML into the thread.
With this approach you get the missing element and ignore the style in the assembly. Granted you have to include several files and the images folder to do it but overall I am happy that it is fixed. I might have just been able to name the Path "BtnImage" but at least this matches the pattern in the other theme files.
Hi Srinivas,
You can download the latest Service Release by going to our web site -> click Account -> select your Product -> select Service Release tab
How to download The development issue with ID of 144406 has been fixed and it is available in the latest Service Release.
Can you please more details for download links.
The development issue with ID of 144406 has been fixed and it is available in the latest Service Release. You can download the Service Release by logging in our web site and then going to Account and Download.