WPF 后台动态生成批量按钮列表
<ListView x:Name="dgDictionaryList" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="5" Foreground="White" Background="#00000000" HorizontalAlignment="Center" Margin="8" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0" >
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel>
</WrapPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Center">
<Button Name="btnKey" CommandParameter="{Binding CODE_KEY}" Content="{Binding CODE_KEY_VALUE}" Style="{StaticResource menu_Button}" FontSize="20" Click="btnCall_Click"></Button>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
string strMsg;
BLL.base_call_records bll_records = new BLL.base_call_records();
var dt = bll_records.GetDataTable50(Global.user.CellCode, out strMsg);
this.gdView.ItemsSource = dt.DefaultView;
this.gdView.Items.Refresh();