wpf-4.0

WPF Sorting ItemsControl under DataTemplate

爱⌒轻易说出口 提交于 2019-12-11 11:12:09
问题 I am using ItemsControl under DataTemplate. I want to sort ItemsControl ic using id column. <DataTemplate x:Key="With"> <DockPanel> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> <TextBlock Text="{Binding Path=fil}" Style="{StaticResource Fixed}" Margin="0,0,6,8" /> <mui:ModernButton IconData="{StaticResource PlayIconData}" Click="FullPlayback" Margin="0,0,6,8" ></mui:ModernButton> </StackPanel> <StackPanel DockPanel.Dock="Left" Orientation="Horizontal"> <TextBlock Text="{Binding

MouseUp not firing on child StackPanels

偶尔善良 提交于 2019-12-11 09:40:11
问题 I cannot seem to find a way to achieve smth very simple: I have an ItemsControl with a UniformGrid inside of it, that arranges items by a DataTemplate : <ItemsControl ItemTemplate="{StaticResource ResourceKey=tmMapCell}" MouseUp="wpSubMap_MouseUp" BorderThickness="1" BorderBrush="DarkGray"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="8" Rows="6" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> Here's the cell template: <DataTemplate x:Key="tmMapCell

Binding to a custom control property

拜拜、爱过 提交于 2019-12-11 06:57:40
问题 Hello I have a custom control. This custom control has it's DataContext set to an entity. In my custom control I then bind some TextBlocks to various properties of this entity. I would also like to bind a TextBlock to a property of the control's class. I do not want/need to set this property through the XAML. Something like <TextBlock Content="{Binding Path=MyControl.Property}" /> Right now, my it seems to be trying to use the bound entity to resolve this binding, rather than my custom

Close page within Frame in a WPF

只愿长相守 提交于 2019-12-11 03:58:14
问题 I have a window and a Frame within it. in that Frame, i open many pages which i would like to close by clicking on "Close" button , the problem is the page can't see my frame i tried to write in an event a close button in a page method to execute another event in a main window because it's easy on a main window to see a frame , but it's not working. here is my code in a page private void closebt_MouseDown(object sender, MouseButtonEventArgs e) { var main = new MainWindow(); main.Exitbt

How to improve performance of WPF Grid control (.NET 4.0/4.5)?

人走茶凉 提交于 2019-12-11 02:39:55
问题 Definition : Having 2D-array of string (about 10 columns, 1,600 rows, fixed length of 7-char) serving as a data source for WPF .NET 4.0 Grid control, the following code snippet has been used in order to populate the Grid with labels displaying values from array. Note : Grid was added to XAML and passed to the function PopulateGrid (see Listing 1.). The visual output is essentially a tabular data representation in read-only mode (no need for two-way binding). Problem : Performance is a key

Allow users to resize Expander in WPF

China☆狼群 提交于 2019-12-10 15:39:11
问题 I have a lot of C# and WinForms experience but am a newbie to WPF. I have a Window with an Expander which expands downward. Much like the question box I'm currently typing in, I'd like users to be able to dynamically resize the Expander by clicking over a glyph at the bottom (like this question box) and dragging the expander to the desired size. Can anyone provide the XAML (and any additional code) to do this? This is what I have so far: <Expander Header="Live Simulations" Name=

WPF ShaderEffect with PS 3.0 shaders

不羁岁月 提交于 2019-12-10 12:05:48
问题 Where could I find examples of PS 3.0 shaders used as ShaderEffects for WPF 4? I'm looking for tutorials, presentations, any resource on this matter. 回答1: The best information you're going to get is that of the MSDN documentation for the ShaderEffect class in WPF 4.0. Were you looking for anything more specific? 回答2: In fact, there still aren't any resources at all on WPF + PS 3.0 (at least after searching 20 minutes on the web). You'll have to wait or create your own PS 3.0 shaders. 来源:

Filtering Datagrid Binded to DataTable WPF

三世轮回 提交于 2019-12-08 12:10:59
问题 I am trying to create a filtering system for a DataGrid in WPF just as in the link - http://www.codeproject.com/Articles/42227/Automatic-WPF-Toolkit-DataGrid-Filtering I am using the same library that they are using but the thing is I need to bind my DataGrid to a datatable... And there is where the error is.. the filter library works perfectly as long as the ItemSource is a LIST but stops to work when the ItemSource is a DataTable... Any Alternatives or Suggestions??? Working Examples

Changing dynamically created button's background in WPF

送分小仙女□ 提交于 2019-12-08 03:29:25
I have the following code to dynamically create and add a button to a panel: StackPanel topPanel=...; Button button=new Button(); button.Content="New Button "+topPanel.Children.Count; // Set button background to a red/yellow linear gradient // Create a default background brush var bgBrush=new LinearGradientBrush(new GradientStopCollection( new GradientStop[] {new GradientStop(Color.FromRgb(255,255,200),0.5), new GradientStop(Color.FromRgb(255,200,200),0.5)})); // Create a more intense mouse over background brush var bgMouseOverBrush=new LinearGradientBrush(new GradientStopCollection( new

WPF DotNET Application will run in debug mode, but .EXE will not run

我是研究僧i 提交于 2019-12-06 20:21:06
问题 I wrote a WPF application in C# using VS 2010. The application will run fine in debug mode using Visual Studio, but when I go to run the .EXE from the bin\release folder, nothing happens. I do not get any error messages from windows and there are no errors or warnings in VS. I have tried to build, rebuild and clean the solution (in every possible order) with no luck. My solution contains 2 projects, both of which use .NET 4.0 framework, and I have .NET 4.0 installed on my PC. I have tried on