Setter.Target give me an error with “RelativePanel.AlignHorizontalCenterWithPanel”

ε祈祈猫儿з 提交于 2019-12-02 06:02:15
Marian Dolinský

For attached properties you have to add brackets to in setters as follows:

Element.(Grid.Row)
Element.(ToolTipService.ToolTip)

So your code will look like this:

<Setter Target="TextBlock.(RelativePanel.AlignVerticalCenterWithPane‌​l)" Value="True" />

Here is a way to create setters for adaptive triggers without writing a single line of code. Since VS provides neither IntelliSense nor error warning for writting them, this helps prevent bugs that are hard to diagnose.

  1. Go to the States panel, click to activate the visual state that you want to add setters to. A red dot will apear next to the name of this visual state.
  2. Once it's activated, go to the Objects and Timeline panel and select the element that you want to interact within this state. In your case, select the TextBlock element.
  3. Go to the Properties panel, either expand the RelativePanel section or search for "relative" in the search box, once the properties come up, simply select the ones you want to change.

That's all! Feel free to check out the gif demo below too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!