wpf-controls

undo/redo command stack for InkCanvas

走远了吗. 提交于 2021-02-07 04:00:05
问题 I am creating paint like application using InkCanvas , I am willing to implement Undo and Redo functionality in my application . Which is the best way to implement Undo / Redo for InkCanvas ?? 回答1: I've implemented undo / redo for a WPF application and ended up publishing my undo / redo code to http://muf.codeplex.com/. You can also get it via NuGet. Just look for "MUF" or "Monitored Undo Framework". It includes support for Silverlight 4.0, as well as .NET 3.5, 4.0, and WP7. In my WPF app, we

Why do i need to use background color on Grid in order to make button event work?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-04 19:20:52
问题 Why Grid, StackPanel etc. needs to have background in order to make MouseDown event work properly? If i don't set background then events that are connected to clicking mouse buttons won't trigger at all. After setting background to even transparent color it starts working properly. What is the purpose of that solution? Is there something going on 'behind' the scene that i don't know about? Does Background setting change more than just background? 回答1: If you don't set a background, you will

WPF Override style from a style trigger

人盡茶涼 提交于 2021-01-29 05:31:00
问题 I have a Radiobutton, which has styling set to make it appear as a ToggleButton, and I want to set its default background color to green, but when it is active/checked i want it to change color. In my example below I'd like it to be blue. No matter what I try the green color never gets overridden. What am I missing? Button: <RadioButton GroupName="Rating" Background="Green" Style="{StaticResource RatingToggleButtons}" x:Name="Normal" Content="Normal" Grid.Row="0" /> Style: <Style x:Key=

Get parent TreeViewItem of a selected node in WPF

别说谁变了你拦得住时间么 提交于 2021-01-28 05:28:59
问题 I want the parent of a node that is selected as TreeViewItem I have a Person class with 2 fields. Name(String) and Children(List of string) This is my xaml code <Grid x:Name="gridView" Margin="10"> <TreeView Name="treeView1" TreeViewItem.Selected="TreeViewItem_OnItemSelected" ItemsSource="{Binding}"> <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsSelected" Value="{Binding IsSelected, Source=Check, Mode=TwoWay}" /> </Style> </TreeView

WPF MeasureOverride and ArrangeOverride

给你一囗甜甜゛ 提交于 2021-01-27 06:01:40
问题 My question here is more of a theoretical one rather than functional. So what I'm looking for is an answer that can maybe be backed up with some documentation. I find myself in the situation where I need to do some custom measurements/arrangements for a wpf control's children? Is it ok to measure the children based on other size constraints rather than the one received as a parameter. Some pseudocode of what I'm trying to achieve: MeasureOverride(size) { foreach(child in children) { if

WPF MeasureOverride and ArrangeOverride

倖福魔咒の 提交于 2021-01-27 06:01:00
问题 My question here is more of a theoretical one rather than functional. So what I'm looking for is an answer that can maybe be backed up with some documentation. I find myself in the situation where I need to do some custom measurements/arrangements for a wpf control's children? Is it ok to measure the children based on other size constraints rather than the one received as a parameter. Some pseudocode of what I'm trying to achieve: MeasureOverride(size) { foreach(child in children) { if

How to increase size of Datagrid Scrollbar?

痴心易碎 提交于 2021-01-21 10:29:10
问题 I have a Datagrid that displays the data on Runtime, and as it has lot of data it itself brings scrollbar on it, but the size is smaller. Can anyone tell how to change size of scrollbar and make it bigger ? <DataGrid x:Name="DgUnitVerReefer" HorizontalAlignment="Center" SelectionMode="Single" SelectionUnit="FullRow" Margin="20,94,26,0" IsReadOnly="True" AutoGenerateColumns="False" Visibility="Visible" VerticalAlignment="Top" Height="334" HorizontalGridLinesBrush="#FFA4C4EA" FontFamily=