Skip to content

Binding Issue 2 #168

@szv

Description

@szv

Hi @Youssef1313

after #156 is resolved, I came across another similiar binding issue.
Would you mind having a look? :)

The binding in the following DataTemplate does not work.
Currently reflection based binding is used, but I also tried it with x:Bind in combination with specifying x:DataType, which didn't work eighter.

<DataTemplate x:Key="PegsTemplate" x:Name="PegsTemplate">
<Grid
Margin="-13,0"
Background="{ThemeResource CardBackgroundFillColorDefault}"
CornerRadius="{ThemeResource ControlCornerRadius}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Path=MoveNumber, Mode=OneTime}" FontSize="{ThemeResource LargeFontSize}" Margin="48,0,10,0" VerticalAlignment="Center" />
<Border Grid.Column="1" Margin="20,0,0,0" Padding="7" x:Name="ShadowTarget">
<ItemsControl ItemsSource="{Binding Path=GuessPegs, Mode=OneTime}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="27" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Ellipse Width="68" Height="68" Margin="12,4" Fill="{Binding Mode=OneTime, Converter={StaticResource ColorConverter}}" Stroke="{ThemeResource TextBoxBorderThemeBrush}" StrokeThickness="1" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>
<Border Grid.Column="2" Padding="30,7" Margin="12,0,0,0" MinWidth="130">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<ItemsControl Grid.Row="0" ItemsSource="{Binding Path=KeyPegs, Mode=OneTime}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="20" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Ellipse Width="25" Height="25" Fill="{Binding Mode=OneTime, Converter={StaticResource ColorConverter}}" Stroke="{ThemeResource TextBoxBorderThemeBrush}" StrokeThickness="1" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Border>
</Grid>
</DataTemplate>

WASM ❌
grafik

WinUI ✅
grafik

Kind regards,
Sebastian

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions