wpf-controls

WPF - Change the place of a control in a grid in code-behind

依然范特西╮ 提交于 2019-12-12 18:34:59
问题 Is it possible to change where a control is placed in a grid from code-behind? For example, if I have a Button in Grid.Row="1", can I change that to Grid.Row="0" from code-behind? 回答1: Yes. Just go: Grid.SetRow(button,0); where button is the element to change. 来源: https://stackoverflow.com/questions/3785572/wpf-change-the-place-of-a-control-in-a-grid-in-code-behind

MouseMove works, MouseDown does not. WPF XAML

不羁的心 提交于 2019-12-12 18:21:16
问题 I made Button in Xaml. I would like to fire MouseDown event: MouseDown="Button_MouseDown_1" I implemented this method in codeBehind, but it doesn't work. But if I implement this method: MouseMove="Button_MouseMove_1" Implementation works. Where is the problem ? Seba. 回答1: The Button element itself is handling the mouse down event before your event handler gets called - meaning your event handler wont get called. More than likely what you're actually wanting to implement is the Click event

All WPF control properties are dependency properties. True or False?

对着背影说爱祢 提交于 2019-12-12 15:09:10
问题 While answering this question I noticed that I have never come across any property which is not a dependency property (WPF Controls, no 3rd party controls). Although, when I started with WPF I remember reading somewhere that "more then 90% of properties of WPF controls are dependency properties". Can anyone give examples/links of CLR properties in WPF controls and why it's so? Update: Came across this lecture: http://www.miszalok.de/Lectures/L17_WPF/C4_DependencyProperties

C# WPF Rating Control Similar to Wifi Signal Indicator

偶尔善良 提交于 2019-12-12 14:13:32
问题 I have searched a lot for WPF Rating Control simliar to the wifi signal strength indicator in this image below but i couldn't find one I tried to make it myself and this is the result :) <Grid> <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="58" Margin="90,114,0,0" Stroke="Black" VerticalAlignment="Top" Width="22"/> <Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="74" Margin="117,98,0,0" Stroke="Black" VerticalAlignment="Top" Width="22"/> <Rectangle Fill="

WPF dataGrid super Header for multiple columns

被刻印的时光 ゝ 提交于 2019-12-12 12:08:46
问题 I want to do Header for multiple columns in WPF DataGrid . I tried with Header template but it will display Header for one column. Below XAML I have tried: <DataGrid> <DataGrid.Columns> <DataGridTextColumn> <DataGridTextColumn.HeaderTemplate> <DataTemplate> <StackPanel> <TextBlock>Column 1</TextBlock> <TextBlock>xyz</TextBlock> </StackPanel> </DataTemplate> </DataGridTextColumn.HeaderTemplate> </DataGridTextColumn> <DataGridTextColumn Header="Header" /> </DataGrid.Columns> </DataGrid> I am

Silverlight App inside WPF WebBrowser?

落爺英雄遲暮 提交于 2019-12-12 10:59:38
问题 I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my

Common Tooltip style in WPF

北城以北 提交于 2019-12-12 10:38:18
问题 Can I make a tooltip style which can be applied to all tooltips for every control. I tried this. <Style TargetType="{x:Type ToolTip}" > <Setter Property="OverridesDefaultStyle" Value="true" /> <Setter Property="HasDropShadow" Value="True" /> <Setter Property="Foreground" Value="White" /> <Setter Property="FontSize" Value="12" /> <Setter Property="Placement" Value="Bottom" /> <Setter Property="VerticalOffset" Value="0" /> <Setter Property="Padding" Value="8" /> <Setter Property=

WPF - TabControl - Prevent Selection Change

女生的网名这么多〃 提交于 2019-12-12 09:43:48
问题 It seems that the WPF TabControl doesn't support the ability to cancel a selection change, since there is no SelectionChanging() event, only a SelectionChanged event. Has anyone figured out a way to do this? The only way I have found is to attach to the PreviewMouseLeftButtonDown() event on each TabItem and set e.Handled to true if I don't want that particular page selected. This seems to work but is clunky. 回答1: I found a way do do this using a style for a TabItem and then binding the

Outer bevel effect on text in WPF

假如想象 提交于 2019-12-12 07:26:56
问题 Is it possible to apply an outer bevel effect to the label text in WPF? as for me, the Glow effect should be sufficient: 回答1: Here's a way to get Glow-effect on Text. Using the OutlinedText control from this link which offers Stroke. <local:OutlinedText FontSize="100" Fill="Black" Bold="True" Stroke="White" StrokeThickness="3" Text="Glow"> <local:OutlinedText.Effect> <DropShadowEffect ShadowDepth="0" Color="White" Opacity="1" BlurRadius="12"/> </local:OutlinedText.Effect> </local:OutlinedText