wpf 相关问题

Windows Presentation Foundation或WPF是用于在基于Windows的应用程序中呈现用户界面的子系统。

formatConverTedBitMap带有alpha

i找到了thomas lebrun实现

回答 1 投票 0

C#microsoft.office.interop.wordblanks

在我的Docx模板中,占位符看起来像这样(带子弹):

回答 1 投票 0

回答 0 投票 0



WPFDataGrid Enum combobox列

在WPF中,如果我使用autogeneratecolumns并将其绑定到我的类对象集合中,它将枚举显示为组合obobox自动在其中我可以在枚举中的所有选项之间进行选择: <

回答 1 投票 0


uniformgrid删除时会重新创建所有儿童控件

UniformGrid <ItemsControl ItemsSource="{Binding WellsCollection, IsAsync=True}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="4" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type controls:WellViewModel}"> <controls:WellView/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> 我的vmWellsCollection是一个,是一个孩子。 从ObservableCollection<WellViewModel>中删除项目,会导致所有现有控件重新创建。 例如,如果我有48WellView控件中包含的48个对控件,则从System.Windows.Controls.Control中删除1个对照将导致47个新的WellsCollection控件构造。 我在WellView构造器中放了一个断点,并得到了此堆栈跟踪: UniformGrid对所有控件进行重新处理非常明显,而且看起来真的很糟糕。 为什么WellViewModel导致控件重建? 我可以做些什么以避免重新创建控件? 提前感谢您! WellsCollection是问题的根源。 没有IT控件,就不会重新创建。 我不确定幕后发生了什么。 the help(Https://learn.microsoft.com/en-us/dotnet/api/system.windows.data.data.binding.isasync?view =windowsdesktop-9.0)说:您的约束源属性可能需要很长时间。”

回答 0 投票 0


How can I suspend and resume layout in WPF?

How can I suspend and resume layout in WPF? I heard that this is not necessary. But this is extremely necessary! I process a lot of change positions, and if they are rendered one by one, it create...

回答 4 投票 0

将控件置于另一个控件的底部或窗口底部的底部,以较高者为准 我有这种情况:

我有这种情况: <Grid> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="*"/> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <StackPanel Orientation="Horizontal" Grid.Row="0"> ... </StackPanel> <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto"> <ItemsControl ItemsSource="{Binding Settings}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"> ... </ItemsControl> </ScrollViewer> <Button Content="Add Row" Grid.Row="2" VerticalAlignment="Top"/> </Grid> 我想要“添加行”按钮以保持在itemscontrol的底部,但我希望该项目scontrol开始滚动,并将“添加行”按钮固定在窗口的底部(因此,每当可以看到)行数将超过窗口范围。 我可以使用第1行的“自动”行大小将按钮固定到控件的底部,并且可以将其固定到窗口的底部,并允许ItemScontrol用“*”“*”行大小滚动,但我不能似乎同时获得了两个。 有一种干净的方法来实现这一目标吗? 我确实试图强迫滚动浏览器的最大视线,但这很快就变得丑陋。 addingVerticalAlignment="Top"对于外网格实现必要的固定 <Grid VerticalAlignment="Top"> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="*"/> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <StackPanel Orientation="Horizontal" Grid.Row="0"> ... </StackPanel> <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto"> <ItemsControl ItemsSource="{Binding Settings}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"> ... </ItemsControl> </ScrollViewer> <Button Content="Add Row" Grid.Row="2" VerticalAlignment="Top"/> </Grid>

回答 1 投票 0

问题是主要方法都是内部的,我们被拒绝使用扩展方法或执行自己的实现。另外,松鼠项目有太多的开放问题,所以我认为这不是一个不错的项目。

回答 1 投票 0



如何提高依赖财产上更改财产的事件?

I具有两个属性的控制。一个是一个依赖性,另一个是第一个的“别名”。 当第一个...

回答 5 投票 0




C#WPF创建DataGrid小区的上下文菜单

上的rigrt click and copy content菜单中获取了Grek40的解决方案,但是它使其正常工作,但是,它在下面提供的代码中对DataGrid单元不起作用。在GREK40解决方案的评论中,Michauzo建议查看DataGridRows

回答 1 投票 0

为什么我的背景颜色是在组合中工作的

我组合盒的唯一部分是背景颜色。我希望整个东西变黄。但是倒塌的部分仍然只是灰色。 <ComboBox Height="25" Width="125" Background="Yellow"> <ComboBox.ItemContainerStyle> <Style TargetType="ComboBoxItem"> <Setter Property="Background" Value="Yellow"/> <Setter Property="BorderBrush" Value="Yellow"/> </Style> </ComboBox.ItemContainerStyle> <ComboBoxItem Content="One"/> <ComboBoxItem Content="Two"/> <ComboBoxItem Content="Three"/> </ComboBox> 也许这可以帮助您: <ComboBox Height="25" Width="125" Background="Yellow" Style="{StaticResource {x:Static ToolBar.ComboBoxStyleKey}}"> <ComboBox.ItemContainerStyle> <Style TargetType="ComboBoxItem"> <Setter Property="Background" Value="Yellow"/> <Setter Property="BorderBrush" Value="Yellow"/> </Style> </ComboBox.ItemContainerStyle> <ComboBoxItem Content="One"/> <ComboBoxItem Content="Two"/> <ComboBoxItem Content="Three"/> </ComboBox> 在使用Windows 7的WPF时,您的代码应按预期工作。但是,如果您正在运行Windows 8或更高版本,则可能不适用该Windows 8。 this thishttps://blog.magnusmontin.net/2014/04/04/04/30/changing-the-background-colour-colour-of-a-combobox-in-wpf-on-wpf-on-windows-8/-可能会帮助您实现什么你想要 作者对此做出了很好的解释。 我在Windows 11中以代码完成了这一点: for (int s=0; (s < ItemContainerStyle.Setters.Count); s++) if (((Setter)ItemContainerStyle.Setters[s]).Property == IsEnabledProperty) { ItemContainerStyle.Setters.RemoveAt(s); break; } ItemContainerStyle.Setters.Add(new Setter(BackgroundProperty,Brushes.Yellow)); 它删除了ISENABLE属性的设置器,这是负责保持Combobox背景灰色的原因。 然后,它添加了一个新的设置器,以使背景为黄色。 注意,似乎您只需要每次运行一次,因为ItemContainerStyle在全球范围内幸存下来。

回答 3 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.