473,659 Members | 3,631 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with binding in WPF

17 New Member
Hello,

I am new to WPF ,I am developing touch screen system using WPF. I am facing problem in Binding relative reference.

Here is my code :

<UserControl x:Class="uctlBr owser"
xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml" Width="300" Height="300">
<Grid Width="Auto" Height="Auto">
<ListBox Name="lstUICate gory" IsSynchronizedW ithCurrentItem=
"True"
ItemsSource="{B inding}" Margin="7,3,0,1 0">
<ListBox.ItemCo ntainerStyle>
<Style>
<Setter Property="Contr ol.Padding" Value="0"></Setter>
<Style.Triggers >
<Trigger Property="ListB oxItem.IsSelect ed" Value="True">
<Setter Property="ListB oxItem.Backgrou nd" Value="DarkRed"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemCon tainerStyle>
<ListBox.ItemTe mplate>
<DataTemplate >
<Grid Margin="0" Background="Whi te">
<Border Margin="5" BorderThickness ="1" BorderBrush="St eelBlue" CornerRadius="4 "

Background="{Bi nding RelativeSource= {RelativeSource Mode=FindAncest or, AncestorType={x :Type ListBoxItem}},
Path=Background
}"
>
<Grid Margin="3">
<Grid.RowDefini tions>
<RowDefinition> </RowDefinition>
<RowDefinition> </RowDefinition>
</Grid.RowDefinit ions>
<TextBlock FontWeight="Bol d" Text="{Binding Path=long_desc} "></TextBlock>
<TextBlock FontWeight="Bol d" Text="{Binding Path=type_id}"> </TextBlock>

</Grid>
</Border>
</Grid>
</DataTemplate>
</ListBox.ItemTem plate>
</ListBox>
</Grid>
</UserControl>



In this code at Backgroud Binding I am getting error :" AncestorType must be specified for RelativeSource in FindAncestor mode. "

So please help me to solve this problem

Thanking you

Regards
Nov 21 '08 #1
0 2552

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1839
by: Tom Hughes | last post by:
I want to change one field of all selected rows to a provided value. Problem 1 I am using the Binding Manager Base to bind the datagrid to the appropriate dataTable as recommended by KB817247. It works in all cases but one. If the field being changed is also one the user has selected as a sort column, then all but the first selections are missed. If I remove the sort from that column before or after
5
2586
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order date, name, address etc) about the selected row in the datagrid... My problem is when I enter a new record in the details tabpage (saves data to database), and go back to the datagrid. Only the data from the PM-table
4
6311
by: JLJ | last post by:
I have a very simple webservice written in Java/Axis. It takes in a complexType with 2 string elements, userid and password. The response is a complexType containing two complexTypes each having 2 strings <wsdl:portType name=SecurityLoginService"> <wsdl:operation name="login"> <wsdl:input message="tns:loginRequest" name="loginRequest"/> <wsdl:output message="tns:loginResponse" name="loginResponse"/> </wsdl:operation> </wsdl:portType>
4
1972
by: leslie_tighe | last post by:
Hello, I have a webservice running on a J2EE server created with Axis 1.2.. I have a client that I am building in .net that needs to consume this webserivce and am having a bit of trouble. I have pasted the wsdl below and have a created a class in VB.net by adding a web refrence to my project. What is odd is that I can successfully call methods that return a simple value like a string. I call also call methods that add an object....
0
2208
by: mjsterz | last post by:
I've been working with VB .NET for less than a year and this is the first time I've posted on one of these groups, so let me apologize beforehand if I'm being unclear, not posting my issue correctly, posting to the wrong forum, or committing some other sort of faux pas. My team is developing a Windows Forms application using VS 2005 with SQL Server 2005 on the back end and we're having a problem using ComboBoxes data bound to lookup...
3
4693
by: shreya | last post by:
While generating client jar files from ant command using build.xml I am getting following error generate-client: Generating client jar for click2pstn.wsdl ... weblogic.xml.schema.model.XSDException: Unable to resolve definition for :c2p:breezeAuthenticationE lementsType perhaps due to the lack of an import statement for namespace http://
8
1835
by: BD | last post by:
Moving from MS Access to .Net using C# languag. Problem trying to duplicate form with structure as follows: 1. Main form 'Work Order' displayed as textboxes 2. subform 'Customers' textboxes showing name, address, etc related by 'CustomerID' 3. subform 'Locations' textboxes showing name, address, etc related by 'LocationID' 4. subform 'Material' on tabbed interface datasheet related by 'WorkOrderID' 5. subform 'Labor' on tabbed...
0
1407
by: StephenLiversidge | last post by:
Hi im having a problem with my wsdl, It generates perfectly and I can create the objects needed from the contract perfectly. The problem comes when I try to pass the object back into the getInitialAvailability function so that I can get the response back. Heres the error im gettting. System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://v2_0.soap:getInitialAvailabilityRequest. ...
2
6582
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.