2
我有一個聯繫人列表,我想要顯示字母表並將沒有對應聯繫人的字母灰掉。更改按鈕的前景色
在我的模型,我有:
public class ContactInitial
{
public string Initial { get; set; }
}
這是從數據庫導出。
在我看來,我有以下
<StackPanel Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Width="17">
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">A</Button >
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">B</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">C</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">D</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">E</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">F</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">G</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">H</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">I</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">J</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">K</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">L</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">M</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">N</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">O</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">P</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">Q</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">R</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">S</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">T</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">U</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">V</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">W</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">X</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">Y</Button>
<Button Height="17" Background="#FFFBF5A6" BorderBrush="{x:Null}">Z</Button>
</StackPanel>
我奮力摸出我如何綁定前景色爲灰色,如果這封信是不是在ContactInitial和黑色的,如果它是。
感謝您的幫助
嗨,特里薩,我已經修改了代碼,讓你有Model屬性 – Rekshino
謝謝你,我做了一個稍微不同的方式,以便在構造函數中,我把下列: _initialString = CurrentContact.Initials; –