wpf-controls

WPF Edit Mask

蓝咒 提交于 2019-12-22 04:07:15
问题 What is the easiest way to specify an edit mask in WPF for a simple Text Box? e.g. one that transforms 10000 to 10,000 as you type. 回答1: Short answer, there is no easy way. If you use masks quite often, I would recommend creating your own control with masking functionality. Using the MaskedTextProvider class should be fairly straightforward. See the following for an example of a custom TextBox with masking capabilities: Masked TextBox example... 回答2: Easiest and most straightforward way is

WPF Edit Mask

心不动则不痛 提交于 2019-12-22 04:07:05
问题 What is the easiest way to specify an edit mask in WPF for a simple Text Box? e.g. one that transforms 10000 to 10,000 as you type. 回答1: Short answer, there is no easy way. If you use masks quite often, I would recommend creating your own control with masking functionality. Using the MaskedTextProvider class should be fairly straightforward. See the following for an example of a custom TextBox with masking capabilities: Masked TextBox example... 回答2: Easiest and most straightforward way is

Limitations of using .NET 2.0 (Windows Forms) controls in WPF?

与世无争的帅哥 提交于 2019-12-21 17:40:13
问题 I want to start a new application on WPF. The new User interface in WPF needs DataGridView control and PropertyGrid Control. But it looks like that these two controls won't exist in WPF and I want to host these two controls using WindowsFormsHost . However, if I do that, is there any limitation anybody forsee with this approach? 回答1: The main limitation is that you loose all the powerful features of WPF: Data binding , ControlTemplates and DataTemplates , Infinite sizing, Zooms/Rotations,

how to make the column editable in ListView?

匆匆过客 提交于 2019-12-21 17:13:05
问题 I use WPF (C #). I want the user to be able to edit the column « Description »: <ListView> <ListView.View> <GridView> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}"></GridViewColumn> <GridViewColumn Header="Number" DisplayMemberBinding="{Binding Path=Number}"></GridViewColumn> <GridViewColumn Header="Description" > <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Description}" TextWrapping="Wrap" Margin="0"></TextBlock> </DataTemplate> <

WPF Custom Control: TemplateBinding to Image

▼魔方 西西 提交于 2019-12-21 11:14:23
问题 I am creating a WPF custom control, a Button with an Image and Text . I have added two dependency properties to the control, ImagePath and Text , and the control template (in Themes\Generic.xaml) is a simple stack panel that arranges the image and text horizontally. The Text property works fine. But for some reason, the sample image in my test project doesn't appear when I use TemplateBinding to the ImagePath dependency property to get its path. I have tested the image by temporarily

How to automatically size TabControl in a DockPanel - WPF

烂漫一生 提交于 2019-12-21 06:23:49
问题 I have a simple WPF Forms app. I have a DockPanel as my root panel. The first child is a StackPanel that has some controls in it, then the second control is a TabControl. What I want, and the panel types can change all they want is for the TabControl to maintain the fill size of the window except for what the first StackPanel consumes. However no matter what I try the TabControl seems to change its size depending on whats inside it, not whats it is inside of. <Window> <DockPanel> <StackPanel>

How to automatically size TabControl in a DockPanel - WPF

六月ゝ 毕业季﹏ 提交于 2019-12-21 06:23:35
问题 I have a simple WPF Forms app. I have a DockPanel as my root panel. The first child is a StackPanel that has some controls in it, then the second control is a TabControl. What I want, and the panel types can change all they want is for the TabControl to maintain the fill size of the window except for what the first StackPanel consumes. However no matter what I try the TabControl seems to change its size depending on whats inside it, not whats it is inside of. <Window> <DockPanel> <StackPanel>

[WPF]How to draw a grid on canvas?

孤街醉人 提交于 2019-12-21 05:49:15
问题 How to draw the following chart as a background on custom canvas inherited from Canvas - system ui element? Thanks for any useful links. 回答1: You can just set Canvas.Background to some DrawingBrush . This brush can just need to render a Rectangle (by using some RectangleGeometry ). Because of supporting for TileMode , we can repeat this rectangle along both horizontal and vertical axes and make the full grid for you: <Canvas> <Canvas.Background> <DrawingBrush TileMode="Tile" Viewport="-10,-10

Use wpf image control to show an image from filesystem

ぃ、小莉子 提交于 2019-12-21 03:20:31
问题 I want to show an image from a file using an wpf image control. The image file resides in the application directory. <Image Stretch="Fill" Source="dashboard.jpg" /> The file dashboard.jpg should be replaceable during or after deployment. How do I have to add the image to the project and what BuildAction do I have to use to have the image read from the file system rather than any source I cannot change after deployment. What source uri do I have to use? 回答1: ImageSource imageSource = new