比方說,我有兩個TextBlock
在同一頁上兩者結合到同一個變量:文本塊修改文本自動
<TextBlock Text={Binding [someViewModel].someText}/>
<TextBlock Text={Binding [someViewModel].someText}/>
//someText = "testingText"
我不知道是否有可能有第一個文本塊,以示「TES .. ....「,第二個文本塊顯示」testingText「?
比方說,我有兩個TextBlock
在同一頁上兩者結合到同一個變量:文本塊修改文本自動
<TextBlock Text={Binding [someViewModel].someText}/>
<TextBlock Text={Binding [someViewModel].someText}/>
//someText = "testingText"
我不知道是否有可能有第一個文本塊,以示「TES .. ....「,第二個文本塊顯示」testingText「?
試試這個
<StackPanel>
<TextBlock Text="testingtext" MaxWidth="20" TextTrimming="CharacterEllipsis" HorizontalAlignment="Left"></TextBlock>
<TextBlock Text="testingtext" ></TextBlock>
</StackPanel>
輸出
我試過你的方式。發生了什麼是沒有任何「...」,但它擴展到下一行。 TES
婷
TEX
–
運行這段代碼分開,你會得到相同的結果,並確保您使用的不是Textwrapping因爲textrapping會做換行(下一行) –
非常感謝你! –
爲其中一個將字符串轉換爲所需自定義格式的綁定創建IValueConverter
。
你想實現什麼?這是你的主要意圖嗎? –
@HamletHakobyan:我不知道如何詳細說明以改善我的問題。大聲笑。 –
有2個這樣的文本塊是您的業務目標嗎? –