Code: Select all
CustomControls(project)/Themes/Generic.xaml
Code: Select all
Code: Select all
public class CustomTableCard : Control
{
public static readonly DependencyProperty BackgroundColorProperty =
DependencyProperty.Register(
nameof(BackgroundColorProperty),
typeof(string),
typeof(CustomTableCard),
new PropertyMetadata(null));
public string BackgroundColorProp
{
get => (string)GetValue(BackgroundColorProperty);
set => SetValue(BackgroundColorProperty, value);
}
public CustomTableCard()
{
this.DefaultStyleKey = typeof(CustomTableCard);
}
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
[...]
}
< /code>
View(Packaged project)/CustomTablePage.xaml
Code: Select all
[...]
View/CustomTablePage.xaml.cs
Code: Select all
public void loadTables()
{
CustomTableCardDataRepository.FillCustomTablesCollection((int)userId);
itemsViewTables.ItemsSource = CustomTableCardDataRepository.customTableItemsCollection;
}
< /code>
Even though the data in customTableItemsCollection
Neue Informationen:
Ich habe experimentiert, um den Standard zu ändern Schaltflächenfarbe und es änderte auch die fehlerhafte Farbe > < /p>
Ich habe den Konstruktorcode debbugiert, aber es hat nie die Zeile erreicht, die die Eigenschaft auf Pink setzt, wenn es nur die erste Taste (Bild oben) gab, stattdessen setzte sie die Eigenschaft auf weiß. Das sind die richtigen Daten. < /p>
Code: Select all
Data(project)/CustomTableCard.cs
Dabei denke ich, dass es ziemlich genau ist zu sagen, dass es frühere Daten aus anderen Schaltflächen erhalten, die entfernt wurden. Die Bindung ist wahrscheinlich stört. Ich weiß jedoch nicht, wie ich dieses Problem angehen soll ...