wpf

WPF - ScrollView Confusion

孤人 提交于 2021-02-19 02:36:33
问题 I am new to WPF and the ScrollViewer is frustrating me. Either I just don't "get" it, or it is a limited control. Here are my Frustrations: Bad Horizontal Scrolling The horizontal scroll bar is only visible at the bottom of the list (I have to scroll to the bottom to see it) Bad Borders I have a ListBox in my ScrollViewer. When I start the bottom of the list has no border and when I scroll down, the top border (line) of the list box disappears. I can kind of understand this, but attempts to

How to use a FolderBrowserDialog from a WPF application with MVVM

房东的猫 提交于 2021-02-19 01:49:07
问题 I'm trying to use the FolderBrowserDialog from my WPF application - nothing fancy. I don't much care that it has the Windows Forms look to it. I found a question with a suitable answer (How to use a FolderBrowserDialog from a WPF application), except I'm using MVVM. This was the answer I "implemented", except I can't get the window object and I'm just calling ShowDialog() without any parameters. The problem is this: var dlg = new FolderBrowserDialog(); System.Windows.Forms.DialogResult result

Binding question in WPF - Diference between Properties and Fields

断了今生、忘了曾经 提交于 2021-02-19 01:35:51
问题 I have a question about how bindings work in WPF. If i have a viewmodel with a property like this: private string testString; public string TestString { get { return testString; } set { testString = value; } } Then if I bind it to a xaml with something like this: <TextBlock Text="{Binding Path=TestString, Mode=TwoWay}" Foreground="Red" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Calibri" FontSize="24" FontWeight="Bold"> </TextBlock> It works... Nothing new here.

Printing large WPF User Controls

帅比萌擦擦* 提交于 2021-02-19 01:33:32
问题 I have a huge data which I want to print using WPF. I found that WPF provides a PrintDialog.PrintVisual method for printing any WPF control derived from the Visual class. PrintVisual will only print a single page so I need to scale the control to fit on the page. Unfortunately this would not work for me since the report was sometimes long enough that it could not be read easily when scaled to fit on the page. Another option for printing provided by WPF is to create a separate view in a

Retaining font size when loading/saving RTF in WPF

拜拜、爱过 提交于 2021-02-19 00:50:46
问题 Consider the following RTF document {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fswiss\fprq2\fcharset0 Segoe UI;}{\f1\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs22 Sample Text\f1\fs20\par } It contains "Sample Text" in font Segoe UI 11 pt. Now when I load and then save the document using WPF's FlowDocument and TextRange.Load() and .Save(), respectively, the font size is reduced to 10.5pt. Is there any way to retain the original font size

Retaining font size when loading/saving RTF in WPF

自古美人都是妖i 提交于 2021-02-19 00:48:03
问题 Consider the following RTF document {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fswiss\fprq2\fcharset0 Segoe UI;}{\f1\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs22 Sample Text\f1\fs20\par } It contains "Sample Text" in font Segoe UI 11 pt. Now when I load and then save the document using WPF's FlowDocument and TextRange.Load() and .Save(), respectively, the font size is reduced to 10.5pt. Is there any way to retain the original font size

How can I retrieve Latitude and Longitude of a postal address using Bing Maps?

故事扮演 提交于 2021-02-18 22:22:09
问题 I want to be able to retrieve the geographical coordinates (latitude and longitude) for a given address. I'm hoping I can do that if I have the full address (street address + city + state + zip). If it matters, I am using Bing Maps. The skeleton code I've got is this (fullAddress, AddPushpin(), and getGeoCordsForAddress() are the most pertinent parts): private void btnSave_Click(object sender, EventArgs e) { string fullAddress = string.Empty; if (MissingValues()) return; mapName = cmbxMapName

How to show just the date and not date and time in a WPF datagrid?

让人想犯罪 __ 提交于 2021-02-18 22:08:53
问题 I have a WPF datagrid with a binding to a class object that looks like the following: <DataGridTextColumn Header="Order Date" Binding="{Binding OrderDate }" /> The property in the class is quite simple, as follows: public DateTime OrderDate { get; set; } When I'm populating this property I'm just sending DateTime.Date (date only, not time): .Select( r => new Customer { Persona = r.Persona, CustomerName = r.CustomerName, Email = r.Email, Organization = r.Organization, PhoneNumber = r

Design-time Error finding the Resource Dictionary - Inconsistent between projects

喜欢而已 提交于 2021-02-18 21:09:50
问题 TLDR; Screens newly referencing an external ResourceDictionary file in VS2015 style correctly at run-time, but not at design-time. What gives? At work, we have a WinForms product which houses many WinForms screens with one developer actively adding new ones, as well as a handful of WPF screens with me adding new ones. Noticing a lot repetitious code/styling in existing WPF screens, I created a single project to house this - to be referenced by all existing/future WPF screens. Project:

Design-time Error finding the Resource Dictionary - Inconsistent between projects

浪子不回头ぞ 提交于 2021-02-18 21:02:42
问题 TLDR; Screens newly referencing an external ResourceDictionary file in VS2015 style correctly at run-time, but not at design-time. What gives? At work, we have a WinForms product which houses many WinForms screens with one developer actively adding new ones, as well as a handful of WPF screens with me adding new ones. Noticing a lot repetitious code/styling in existing WPF screens, I created a single project to house this - to be referenced by all existing/future WPF screens. Project: