473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

WPF: FindAncestor of Unknown Type

Hello,

I am creating a ControlTemplate for a ComboBox. This ComboBox will have a
transparent background so it uses the control it is placed in as its
background.

I would like the background of the Popup to also match the parent control.
It cannot use the Transparent background of the ComboBox, because it may span
outside the parent control. However, we want there to be enough flexibility
to place this on different controls, so I don't necessarily know the parent
control type to use FindAncestor against.

Thanks,
WdS
Jan 17 '08 #1
3 4789
WdS,

So why are you calling FindAncestor? If you want the popup background
to be transparent, then just specify it in the declaration of the popup (or
not, if you don't want that). Why the call to FindAncestor?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Wonko the Sane" <Wonko the Sa**@nospam.nospamwrote in message
news:4B**********************************@microsof t.com...
Hello,

I am creating a ControlTemplate for a ComboBox. This ComboBox will have a
transparent background so it uses the control it is placed in as its
background.

I would like the background of the Popup to also match the parent control.
It cannot use the Transparent background of the ComboBox, because it may
span
outside the parent control. However, we want there to be enough
flexibility
to place this on different controls, so I don't necessarily know the
parent
control type to use FindAncestor against.

Thanks,
WdS
Jan 17 '08 #2
Sorry - I wrote that after a very long day....

The problem is that the popup is transparent. I actually want the popup
background to be the color of the parent of the combobox.

Thanks,
WtS

"Nicholas Paldino [.NET/C# MVP]" wrote:
WdS,

So why are you calling FindAncestor? If you want the popup background
to be transparent, then just specify it in the declaration of the popup (or
not, if you don't want that). Why the call to FindAncestor?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Wonko the Sane" <Wonko the Sa**@nospam.nospamwrote in message
news:4B**********************************@microsof t.com...
Hello,

I am creating a ControlTemplate for a ComboBox. This ComboBox will have a
transparent background so it uses the control it is placed in as its
background.

I would like the background of the Popup to also match the parent control.
It cannot use the Transparent background of the ComboBox, because it may
span
outside the parent control. However, we want there to be enough
flexibility
to place this on different controls, so I don't necessarily know the
parent
control type to use FindAncestor against.

Thanks,
WdS
Jan 17 '08 #3
Hi WtS,

I think you can use

AncestorType={x:Type UIElement}

Use AncestorLevel to skip some levels of unwanted parents.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Jan 19 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: RobinS | last post by:
I'm trying to learn WPF and do it in VB instead of C#. (God forbid I should do *anything* the easy way. ;-) Here's something weird. On p162-3 of this book by Petzold (in C# of course) in an...
1
by: Ronald S. Cook | last post by:
I'm just learning CAB/SCSF and it seems pretty complex. I'm also wondering, though, if Windows Presentation Foundation (WFP) will make CAB/SCSF obsolete in the future (i.e. that it would have...
3
by: Linda Liu[MSFT] | last post by:
Hi Moondaddy, This is a quick note to let you know that I'm performing research on this issue and will get back to you ASAP. I appreciate your patience! Sincerely, Linda Liu Microsoft...
8
by: moondaddy | last post by:
I'm posting code for a user control ( FunctionConnectorSelector) below which has 3 content controls in it. each content control uses a style from a resource dictionary merged into the app.xaml...
7
by: Jeremy | last post by:
I'm getting started with WPF & am converting a small asp.net app that uses a couple of dropdownlists. They have the useful feature of holding a string and also another (index) value in each item. ...
23
by: raylopez99 | last post by:
Here I am learning WinForms and two months into it I learn there's a WPF API that is coming out. Is this WPF out yet, and is it a threat to WinForms, in the sense that all the library routines I...
1
by: raylopez99 | last post by:
Took a look at a demo of font dialog for WPF, and it looks complicated. You could do the same thing in C# 3 WinForms 2.0 in about one-half to one-fourth the code. So I wonder, for you that have...
0
by: Andy | last post by:
Hi, I'm trying to understand why something does work. If you create a new WPF Applicatin project, WpfApplication6, and set the following: MainWindow.xaml: <Window...
0
by: furqanms | last post by:
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="uctlBrowser" ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.