Setting style based on existence of an ancestor type
问题 I have 2 sets of textblocks some of them are in an itemcontrol and some of them are not, I want to make an style (just based on type) which sets the background of the textblock if its ancestor is an ItemControl. I can do it by the following code but the problem is that on the log (and output window) a data biding error message will be displayed because of the textblocks which do not have Itemcontrol as ancestore. Is there any better way to do this task and avoid this error message? <Grid>