我有乙個tabcontrol
<view codetabcontrol
x:name
="toolsystemsection"
grid.row
="4"
contenttemplate=""
issynchronizedwithcurrentitem
="true"
itemcontainerstyle=""
itemssource=""
style=""
>
<
tabcontrol.background
>
<
lineargradientbrush
startpoint
="0,0"
endpoint
="0,1"
>
<
gradientstop
offset
="1"
color
="#ff6c6c6f"
/>
<
gradientstop
color
="#ffa8aaad"
/>
lineargradientbrush
>
tabcontrol.background
>
tabcontrol
>
要實現上面的behivor需要設計其trigger。
<方法一:設定乙個trigger和乙個multitrigger,其實<style
x:key
="waterswellhttoolsystemitemcontainer_template"
targettype=""
>
<
setter
property
="template"
>
<
setter.value
>
<
controltemplate
targettype=""
>
<
border
x:name
="border"
height
="35"
minwidth
="180"
background
="#808284"
borderthickness
="1,1,3,0"
cornerradius
="3,3,0,0"
>
<
grid
background
="transparent"
>
<
grid.columndefinitions
>
<
columndefinition
width
="140"
/>
<
columndefinition
width
="30"
/>
grid.columndefinitions
>
<
textblock
horizontalalignment
="center"
verticalalignment
="center"
fontsize
="11pt"
style=""
text=""
/>
<
button
x:name
="closebutton"
grid.column
="1"
horizontalalignment
="center"
command=""
style=""
visibility
="collapsed"
/>
grid
>
border
>
<
controltemplate.triggers
>
<
trigger
property
="isselected"
value
="true"
>
<
setter
targetname
="closebutton"
property
="visibility"
value
="visible"
/>
<
setter
targetname
="border"
property
="background"
value
="#ffa7a9ab"
/>
trigger
>
<
multidatatrigger
>
<
multidatatrigger.conditions
>
<
condition
binding="}
"value
="true"
/>
<
condition
binding
="}}
"value
="1"
/>
multidatatrigger.conditions
>
<
setter
targetname
="closebutton"
property
="visibility"
value
="collapsed"
/>
multidatatrigger
>
controltemplate.triggers
>
controltemplate
>
setter.value
>
setter
>
style
>
resourcedictionary
>
condition
binding="}
"value
="true"
/>不用寫
方法二:設定乙個trigger和乙個datatrigger
說明的三點問題:
multidatatrigger裡只能有binding模式的trigger,所以叫datatrigger。但是需要用到control itself自己的乙個屬性path=isselected,要寫成binding
="}的模式,對比其在普通trigger下的表現實行
<
trigger
property
="isselected"
value
="true">
<
condition
binding
="}}
"value
="1"
/>
屬性items.count是
裡的屬性,所以這裡寫成ancestortype=而不是templateparent
<
controltemplate.triggers
>......
controltemplate.triggers
>
可以同時包含多種混合的trigger
關於winapi建立tabcontrol的方法
建立tabcontrol的步驟 新增控制項 建立子視窗 設定tcitem的成員 控制子視窗的顯示與否 新增方法 設定tabcontrol控制項的標籤 tie.mask tcif text tie.psztext tablabel i senddlgitemmessage hdlg,idc tab1,...
關於tr的父節點
在學習js過程中遇到乙個問題 name email salary tomtom tom.com 5000 delete 我要向table裡面刪除元素節點,利用removechild 方法得到下面 var del document.getelementsbytagname a for var i 0 ...
關於qt中的tr()函式
在論壇中漂,經常遇到有人遇到tr相關的問題。用tr的有兩類人 注意哦,如果你正在用tr包裹中文字元,卻不屬於 2b 那麼,這是個訊號 如果你確實屬於 2b 請做好心理準備,你可能還會遇到很多困難,請考慮qt國際化 原始碼含中文時 的點滴分析 tr 是做什麼的?下面二者的區別是什麼?qstring t...