Exemplo n.º 1
0
        private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (!e.WidthChanged)
            {
                return;
            }
            if (ResultListBox.ItemsSource == null)
            {
                return;
            }
            var textWidthManager = new TextWidthManager();

            foreach (SearchResult item in ResultListBox.ItemsSource)
            {
                var searchBoxInfo = new SearchBoxInfo
                {
                    Width    = e.NewSize.Width,
                    FontSize = ResultListBox.FontSize,
                    FontName = ResultListBox.FontFamily.ToString()
                };
                item.ShowPath = textWidthManager.GetSubStringForWidth(item.FullPath, searchBoxInfo);
            }
        }