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

后端 未结 2 1803
我寻月下人不归
我寻月下人不归 2021-01-24 22:33

I am develop an UWP app, and I am using Template10. I have an TextBlock, that in VisualStateNarrow I want it RelativePanel.AlignVerticalCenterWit

相关标签:
2条回答
  • 2021-01-24 22:59

    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" />
    
    0 讨论(0)
  • 2021-01-24 23:19

    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.

    0 讨论(0)
提交回复
热议问题