wpf-controls

How to calculate the total rendering time of a wpf control?

 ̄綄美尐妖づ 提交于 2019-12-12 07:22:39
问题 Is there any profiler or tools available to calculate the "Rendering Time" of a particular control. Rendering Time - Time taken by the control to completely render visually on to the screen. 回答1: I don't know of any tools, but if its just a single control you could create a sub class, override the Render methods and use a StopWatch to find some timings... 回答2: Here is a nice tip on the same subject too to make the measurment from the ViewModel(using the Dispatcher): http://www.japf.fr/2009/10

How to bind click of a button to change the content of a panel (Grid) using XAML

孤街醉人 提交于 2019-12-12 07:22:26
问题 I am creating a UI of a WPF Application, and while working on the implementation of the software's features, i didn't have much experience with creating the UI. Now I need to a way to change the contents of the Properties panel which has a grid to contain the content. I have created multiple panels, hidden all but one, and now i want to switch when the user clicks on a button in the Ribbon on the top, (or it could be any button somewhere else in the layout). It is very easy to do with code,

GridView DoubleClick

喜夏-厌秋 提交于 2019-12-12 07:21:12
问题 I have a GridView where I want to detect a doubleclick event on the items in the list, i do it as follows: <ListView> <ListView.View > <GridView > <GridViewColumn Header="FileName"> <GridViewColumn.CellTemplate> <DataTemplate> <Label Content="{Binding FileName}" MouseDoubleClick="Configuration_MouseDoubleClick"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn DisplayMemberBinding="{Binding CreationDate}" Header="Date"/> </GridView> </ListView.View> </ListView

WPF ObservableCollection Edit Mode

∥☆過路亽.° 提交于 2019-12-12 07:15:00
问题 I am using observable collections all around my applications. My problem is that when i use a popup window for editing those entities, my bound lists are getting changed when the user changes those corresponding fields in the window. How could i simply freeze the observable changes norifications, and release them only when the entity is saved? Thanks, Oran 回答1: You could make a deep copy of the object you want to edit. This way, you can act on the copy while editing, without interfering with

Removing WPF ListView/GridView highlight chrome

大憨熊 提交于 2019-12-12 07:12:29
问题 I have WPF ListView with GridView view and I want to remove any trace of row highlight. This useful piece of code can be found in one answer on this site: <ListView.ItemContainerStyle> <Style TargetType="{x:Type ListViewItem}"> <Setter Property="Control.Focusable" Value="False"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="{x:Null}" /> <Setter Property="BorderBrush" Value="{x:Null}" /> </Trigger> </Style.Triggers> </Style> </ListView

How to localize the WPF 4.0 DatePicker control

。_饼干妹妹 提交于 2019-12-12 07:10:05
问题 When you clear the box on the new WPF 4.0 DatePicker control it shows "Select a date" Is there a way to localize the text? 回答1: Unfortunately, setting the watermark text is a bit tricky. How it can be done you can see in this article: Changing the watermark text in a DatePicker control 回答2: I have taken Matt's idea, and extended it somewhat; I've implemented an Attached Behaviour which allows you to define the watermark for each DatePicker control through XAML. Here is the code: namespace

CurrentPosition property not being updated properly

ⅰ亾dé卋堺 提交于 2019-12-12 06:12:22
问题 Let me try again...here is the XAML. You can see the CollectionViewSource, the Grid that uses it as a DataContext, the ListView, and the Delete button. What is happening is that when i click on a row in the ListView (and the Style trigger fires to select the ListViewItem) the row is selected. When i click the Delete button the onclick fires but the CurrentPosition property is set to -1. What is preventing the CurrentPosition property from being updated. XAML <Window x:Class="PretzelsUI.Admin

C#/WPF: interaction with web browser control?

跟風遠走 提交于 2019-12-12 05:49:21
问题 Is it possible to interact with the source code of a local or remote page in real time through the use of the WPF browser control. A simple example of what I mean would be where the user can click a button that will bold the selected text. Sort of like a WYSIWYG HTML editor but using the browser control. Is there a way to interact with the source code like this with the same power you have with JavaScript. Would one have to set up a system to parse the selected web page and then modify its

How to use UIElement[] CreateLabels method in NumericLabelProviderBase class to insert label or text in a point inside plotter

三世轮回 提交于 2019-12-12 05:07:38
问题 I'm tring to override CreateLabels to insert labels or text in specific points in plotter chart but I need a help in: 1. what does the parameter ( ITicksInfo<double> ticksInfo ) mean and what should I send to it 2. how to use the return value to add labels to already defined Axis like _stringaxis.LabelProvider or if there is simpler way to add text in a point please tell, Many thanks. 回答1: Just found the easiest way to add a nice label inside the chart. CenteredTextMarker label = new

How to bind to collection 2 deep?

不羁的心 提交于 2019-12-12 04:39:44
问题 I have the following collection structure and need to bind a combo box to it: MainCollection.Items Items contains a list of elements I'd like to display as choices in a combo box. MainCollection is of type List. Items is of type List. There is a Name property on the Item class that I'd like to display in the combo box. The layout will be setup as a grid. Each row will have a combo box. I'm not sure how to access properties on Item elements inside the Items collection. <ComboBox ItemsSource="