Example #1
0
        private void ShowListItem(List <Item4Show> items)
        {
            DispatcherEx.xInovkeLowestPriority(() => {
                try
                {
                    tvMain.Items.Clear();
                    int no = 0;
                    foreach (var itShow in items.xSafeForEach())
                    {
                        no++;
                        var headerPnl         = new StackPanel();
                        headerPnl.Orientation = System.Windows.Controls.Orientation.Horizontal;

                        var noTxt     = new TextBlock();
                        noTxt.Text    = string.Format("{0}.", no);
                        noTxt.Padding = new Thickness(0, 5, 0.0, 0);
                        var leaf      = new CtlLeaf(itShow.Text.xRemoveLineBreak(" ").Trim(),
                                                    itShow.HighlightKey,
                                                    null, itShow.ImageName,
                                                    itShow.ActUseImage,
                                                    null);

                        headerPnl.Children.Add(noTxt);
                        headerPnl.Children.Add(leaf);

                        var it    = tvMain.xAppend(headerPnl, null);
                        it.Tag    = itShow.Tag;
                        it.Margin = ItemMargin;

                        it.MouseDoubleClick  += tvMain_MouseDoubleClick;
                        it.MouseLeftButtonUp += tvMain_MouseLeftButtonUp;
                    }
                }
                catch (Exception e)
                {
                    Log.Exception(e);
                }
            });
        }