DataControl ItemsControl ... binding to current item does not work

I have the following ItemsControl page ...

<Page x:Class="Kiosk.View.ItemListView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:Converter="clr-namespace:Kiosk.Converter" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      Margin="10"
      Title="ItemListView">
    <StackPanel>
        <Button Width="130" Height="130" Style="{StaticResource DarkButton}" 
                Command="BrowseBack" Content="Back" HorizontalAlignment="Left" Margin="0,0,0,5"/>
        <ItemsControl ItemsSource="{Binding EventClassSummaries}">
            <ItemsControl.Resources>
                <Converter:OxiStringConverter x:Key="oxiStringConverter" />
            </ItemsControl.Resources>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Height="1000" Width="900" Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Content="{Binding Path=Name}"
                            Style="{StaticResource DarkButton}"
                            Height="42"
                            Width="440"
                            FontSize="12pt"
                            Margin="4"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </StackPanel>
</Page>

EventClassSummaries It works correctly, since I get the right number of buttons in my wrapper, the data is received from the WCF service, and the individual elements look like this (from the service side)

[DataContract]
public class EventClassSummary
{
    [DataMember] public string Category;
    [DataMember] public char Displayed;
    [DataMember] public int Id;
    [DataMember] public string Name;
    [DataMember] public char Status;
}

I have a problem: the buttons do not display the binding Name, and I just get spaces.

Oddly enough, this worked on Friday, but I had to rebuild the service and add some additional methods (although I did not touch on those related to this!)

Does anyone have any ideas, it seems to me that it was a little strange that this worked (I even demonstrated it before PM)

+1
source share
1 answer

DataBinding WPF .

, :

[DataMember] public string Name;

public string _Name;
[DataMember]
public string Name
{
    get { return _Name; }
    set { _Name = value; }
}

. , , , - - .

+1

All Articles