wpf-controls

How can I add a tab control on to the window title bar

让人想犯罪 __ 提交于 2019-12-13 07:22:54
问题 I want to add the tab control header (or styled list box) to the windows title bar like this: New window title bar I plan to edit the window template to achieve this. But I don't know where to add. Here is the window template I edit in Blend: <ControlTemplate x:Key="WindowTemplateKey" TargetType="{x:Type Window}"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <Grid> <AdornerDecorator>

how to access the label inside datatemplate

大城市里の小女人 提交于 2019-12-13 07:16:09
问题 hello everybody i have a listbox within which is a datatemplate.Inside it is checkbox,textbox,label...Wat i want is to get the value of the label wen the checkbox is unchecked? or any alternative as to how to access the label value but only wen the checkbox is unselected............PLease help me out. the code is as <ListBox.ItemTemplate> <DataTemplate> <StackPanel Name="sp" Orientation="Horizontal" Margin="3,3,3,3" > <CheckBox Name="chkSubject" IsChecked="{Binding RelativeSource

WPF FlowDocument :: How Can I Define Custom Templates for the Child Paragraph, Run, etc

我与影子孤独终老i 提交于 2019-12-13 06:52:37
问题 I'm fairly new to WPF, so please bear with me. I am trying to customize the presentation of the various elements of a FlowDocument in a RichTextBox (RTB). WPF controls are lookless, so as I understand it I should be able to define the look for every child in the Document . Would I define the template for this in the RTB? Separate templates for each item ( Paragraph , Section , Run , etc) as resources? Let's say, for sake of argument, that I want a red border around every Section , the word

getting information from a data binding listBox for a new page

匆匆过客 提交于 2019-12-13 06:39:34
问题 I have a news section that consist of listBox binding from a ViewModel (listBox include) <controls:PanoramaItem x:Name="News" Header="News"> <!--Double line list with image placeholder and text wrapping--> <ListBox x:Name="News_ListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}"SelectionChanged="SelectNewsItem"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Margin="0,0,0,17"> <!--Replace rectangle with image--> <Rectangle Height="100" Width="100" Fill="

Why OnMouseDown handler exists but is not called for an ellipse?

时光毁灭记忆、已成空白 提交于 2019-12-13 05:49:13
问题 I have an ellipse (inside a grid of a UserControl) and created this event handler for MouseDown but why it is never called ? private void ellipse1_MouseDown(object sender, MouseButtonEventArgs e) { MessageBox.Show("Ellipse"); } I have no children inside the ellipse so there is no event bubbling involved. This is crazy behavior. 回答1: By default the 'Fill' on an ellipse, and other shapes is null. If you set it to any color at all (even transparent), you fill find that clicking on it will give

Help needed in drawing 3D scrollbars

微笑、不失礼 提交于 2019-12-13 05:39:39
问题 I need to write the following component in WPF: It should be over image, I should able to drag the lines with the mouse (drag X up and down, drag Y left and right, and Z spin from horizontal to vertical) My backround in WPF is almost not exist, Can you give me guidliness? do you know component that doing it, or something similar to that? Do you know what is the name of this control? Thanks. 回答1: I refactored the program in http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part1.aspx In the

Disable Control's Selection Background Effect in WPF

匆匆过客 提交于 2019-12-13 05:27:39
问题 I have a ListView which shows a collection of objects. I want to disable the "Blue effect" or "Blue rectangle" when clicking on the ListViewItem, and Let only the object in this Item enabled. Does anyone has an idea about that ?? Here is an Example of one of my ListViewItems: Here is my listView: <ListView SelectionMode="Single" IsManipulationEnabled="True" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility=

Button click changes visibility of a DataGrid with a Trigger in WPF

拟墨画扇 提交于 2019-12-13 05:27:11
问题 Hi i am trying to find some way to when a button is clicked changes the visibility of other control, like a DataGrid with a Trigger in XAML. The button only changes the visibility of the DataGrid to Visible, it does other things in Code Behind, but this is something that i think that can be done in a Style with a Trigger. I tried to find a solution and it seems to be possible to do but i can't understand how. Thanks in advance. 回答1: <Button Content="Button!"> <Button.Triggers> <EventTrigger

Binding the position and size of a UserControl inside a Canvas in WPF

一个人想着一个人 提交于 2019-12-13 05:09:36
问题 We need to dynamically create (i.e. during runtime, via code-behind) UserControls and position them on a Canvas. We want to bind the position (Canvas.Left and Canvas.Top) and width of those sizable (!) and draggable (!) UserControls to a ObservableCollection<>. That measn when the user drags or resizes the control, the datasource gets automatically updated. How would we achieve this if the Usercontrol is contained in a DataTemplate which in turn is used by a ListBox whose DataContext is set

WPF Text Box Validation on numeric value

久未见 提交于 2019-12-13 04:33:40
问题 if have a text box in xaml. i want only numeric values can be write in textbox to validate on button. how can i do it ? <TextBox x:Name="txtLevel" Grid.Column="1" HorizontalAlignment="Stretch"></TextBox> 回答1: I would create a class to host all of the additions to textbox that you want to make like below, the bit that stops you putting numbers is in the event handler for PreviewTextInput, if it's not numeric I just say the event is handled and the textbox never gets the value. public class