wpf-controls

WPF TreeViewItem Toggle Button visibility

六月ゝ 毕业季﹏ 提交于 2019-12-19 19:57:25
问题 I've ran into an issue I'm hoping someone can help me solve. I've run into a case where my nodes contain a set of child nodes with visibility set to false. I'm hoping that I can disable the toggle arrow beside the TreeViewItem if all it's children are invisibile. Is this possible? Here's an example: <TreeView Margin="10,10,0,13" Name="TreeView1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="194" Height="200"> <TreeViewItem Header="Cold Drinks"> <TreeViewItem Header="Coke"

WPF radio button with Image

拥有回忆 提交于 2019-12-19 18:55:40
问题 I have to create something similar to the picture. If one of the button is clicked the others should become darker. Thanks a lot! That's what I need 回答1: you can change Opacity when RadioButton is not checked via style trigger <RadioButton.Style> <Style TargetType="RadioButton"> <Style.Triggers> <Trigger Property="IsChecked" Value="False"> <Setter Property="Opacity" Value="0.5"></Setter> </Trigger> </Style.Triggers> </Style> </RadioButton.Style> image inside can be created by modification of

How can I bind an ItemsControl.ItemsSource with a property in XAML?

一世执手 提交于 2019-12-19 16:15:47
问题 I have a simple window : <Window x:Class="WinActivityManager" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> <ListView x:Name="lvItems" /> </Grid> </Window> And the associated code behind : public partial class WinActivityManager : Window { private ObservableCollection<Activity> Activities { get; set; } public WinActivityManager() { Activities = new ObservableCollection<Activity>(); InitializeComponent(); } //

Populating ComboBox inside ListView in WPF

浪尽此生 提交于 2019-12-19 09:50:01
问题 I have populated a ComboBox inside a ListView . Screen shot is given below As shown above it's displaying "M", "a", "c" instead of "Mac". Why it is separating the word into characters? In code behind file I've written ItemCategoryDAL itemCategoryDalObj = new ItemCategoryDAL(); DataTable dataTable = itemCategoryDalObj.GetAllItemCategory(); listView1.ItemsSource = dataTable.DefaultView; And in .xaml file I've written: <ListView Height="148" HorizontalAlignment="Left" Margin="23,12,0,0" Name=

WPF TextBlock Overlaps Ellipse

霸气de小男生 提交于 2019-12-19 02:02:16
问题 I am trying to create this in WPF (I realize I could just use an image, but I am trying to learn WPF): (source) This is what I have so far but it isn't producing the desired result, in that, the textbox seems completely hide the ellipse whereas it should simply have a transparent background: <StackPanel> <TextBlock HorizontalAlignment="Left" Margin="144,207,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/> <Ellipse HorizontalAlignment="Left" Height="52" Margin="142,189,0,0"

How to use stringformat in multibinding in WPF XAML

梦想的初衷 提交于 2019-12-18 19:01:23
问题 As you know StringFormat is of great importance for data representation in WPF. My problem is how to use StringFormat when multibinding in WPF? If I give a very simple example: We have variables,which are A and B and whose values are 10.255555 and 25.6999999 And we want to show them 10.2,25.6 ? How can I do this with multibinding? Normally it is piece of cake with ValueConverter Any help and ideas on this topic will be greately appreciated 回答1: Just set the StringFormat property on the

WPF CheckBox with “Button” appearance

十年热恋 提交于 2019-12-18 18:50:26
问题 I need a button-like control that can have a Checked property, so that when clicked it stays pressed. I had that functionality in WinForms, with the CheckBox control, setting the Appearance property to "Button". Can someone help me? 回答1: Use a ToggleButton, it has all the functionality you see in a CheckBox since it is derived from it. 回答2: WPF has a built-in ToggleButton control that serves this purpose. If you need to change the visual appearance of this default control you will need to

Enabling Scrollbar in WPF

末鹿安然 提交于 2019-12-18 18:34:30
问题 I'm having a problem right now where my WPF application hides anything below the fold when the window is too small vertically. How can I use XAML to get a vertical scrollbar to appear for the entire app so the user can scroll to see the rest of the content? 回答1: Put a ScrollViewer inside your Window: <Window x:Class="WpfApplication2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300"

A draggable popup control in wpf

我的梦境 提交于 2019-12-18 17:26:26
问题 I need a draggable popup control in wpf and was wondering if any of your guys could help me out..I did see the following post: Drag WPF Popup control but that isnt how its supposed to work...? When i click and drag it always resets to a specific point and moreover the commenters said that this is not an efficient approach...? Does anyone have any alternatives? Thanks! 回答1: You could open a child Window with a custom border layout. Then add a MouseDown handler that enables the dragging:

http://schemas.microsoft.com/winfx/2006/xaml/presentation definition

拜拜、爱过 提交于 2019-12-18 16:52:13
问题 When you create a new WpfApplication project in Visual Studio you get the following XAML. Copying and pasting the URL http://schemas.microsoft.com/winfx/2006/xaml/presentation into the browser I expected to see the XSD file definition but I get an error. Why? Thanks. <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> </Grid> <