wpf-controls

WPF custom control question

五迷三道 提交于 2019-12-24 18:28:53
问题 i've done this before but i cannot find my old code. how do you embed a window inside a window. let say i created a custom form and saved it as Window1.xaml, and want to embed it in Window2.xaml, without copy and pasting the xaml code.. TIA EDIT: i think my question is somewhat misleading, i'll rephrase it. i have this Window1.xaml i added custom headers and background images/colors. then in Window2.xaml, i want Window1 to be a custom control and embed it here. not sure if its Content

Accessing font properties of wpftext control in codedUI testing

試著忘記壹切 提交于 2019-12-24 16:46:03
问题 I want to check whether font is bold or not and also its color in codedui testing. I am using wpftext control . Please help me. 回答1: Saran, Unfortunately, this is not as straightforward as it probably should be, but it can be done by creating a CodedUI Test Framework Extension which sets an AutomationProperties.ItemStatusProperty to the current Font. One benefit of doing it this way is that it works with the test recorder and allows you to generate assertions and/or hand-code validations.

Print documents via Wpf-controls and convert to XPS

邮差的信 提交于 2019-12-24 15:44:00
问题 I'm trying to convert XAML control to XPS document, but i'd like to do this in batch mode - render control in memory and print it to XPS without rendering it on the screen. This project should work even without GUI. I've read Related topic on stackoverflow, but it's not working properly. I can create control, set DataContext, but output xps is empty. If i render control on the screen and then print it, everything is ok, but if i'd like to do this in batch mode, i got empty document (there was

Display datagrid details from the combobox selecteditem

落爺英雄遲暮 提交于 2019-12-24 11:28:36
问题 I have a combobox and a datagrid in my application. The datagrid has its itemsSource from its collectionViewSource and there are three ComboBoxItem 's in the combobox as warning/error/exception as shown in the image below. How to display the selecteditem row details on the datagrid when the respective ComboxBoxitem is selected. this what I have tried. Combobox - XAML <ComboBox SelectedValuePath="{Binding ElementName=dataGrid1,Path=SelectedItem.Type,Mode=OneWay}" Grid.Column="1" Height="32"

How to change a ListBox's Vertical Scrollbar's Repeat Button Size in WPF

僤鯓⒐⒋嵵緔 提交于 2019-12-24 10:56:52
问题 I have a ListBox control with a vertical scrollbar. I would like to increase the Repeat Buttons' Height to something bigger because our UI is touch-compatible. Is there a simple way to do it ? Thank you and best regards, Romanin 回答1: Easiest is to modify the ControlTemplate for a vertical scrollbar and change it to what you want: ScrollBar ControlTemplate Example 回答2: It's not so easy to just change the button sizes, because they are hardcoded in the default template. But you can scale the

Control for adding key/value pairs?

自古美人都是妖i 提交于 2019-12-24 09:48:28
问题 I need a control to allow users to add/delete/edit rows of key/value pairs. What's the best control to use for this? Does anyone have an example? I'm quite new to WPF. 回答1: I'd use a simple dialogue with two labelled text boxes, the new pair would be added to the original data which should be bound to the DataGrid so that rows are generated automatically. Edit: A DataGrid example solution. XAML: <Window ... DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"> <StackPanel

Weird rendering behavior in WPF for ToolTips with brackets or parentheses

拈花ヽ惹草 提交于 2019-12-24 09:46:13
问题 I have a button with a tool tip defined as follows: <Button Width="25" ToolTip="Delete selected name (Ctrl + F12).">-</Button> When I hover over the button at run time the tooltip displays as (.Delete selected name (Ctrl + F12 I have also tried defining the tooltip as <Button Width="25"> <Button.ToolTip>Delete selected name (Ctrl + F12).</Button.ToolTip> - </Button> I have also tried using brackets instead of parentheses. In all cases text after the final closing ) or ] is being cut off and

Control for adding key/value pairs?

為{幸葍}努か 提交于 2019-12-24 09:42:41
问题 I need a control to allow users to add/delete/edit rows of key/value pairs. What's the best control to use for this? Does anyone have an example? I'm quite new to WPF. 回答1: I'd use a simple dialogue with two labelled text boxes, the new pair would be added to the original data which should be bound to the DataGrid so that rows are generated automatically. Edit: A DataGrid example solution. XAML: <Window ... DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"> <StackPanel

Autocompletebox doesn't clear keyboard strokes

流过昼夜 提交于 2019-12-24 08:47:34
问题 In an application of mine, I'm using the WPF autocomplete box from the wpf toolkit. I'm implementing it via the MVVM pattern. The binding works fine, but I have a small problem when trying to clear the content of the autocompletebox. Setting the bound property in the viewmodel to null, clears the text only partially (all text entered via the keyboard is not cleared - i.e. if I enter CH when fetching all the cities and select Chicago and the set the bound property to null, the CH is not being

WPF Focus In Tab Control Content When New Tab is Created

青春壹個敷衍的年華 提交于 2019-12-24 08:23:48
问题 I've done a lot of searching on SO and google around this problem, but can't seem to find anything else to try. I have a MainView (window) that contains a tab control. The tab control binds to an ObservableCollection of ChildViews (user controls). The MainView's ViewModel has a method that allows adding to the collection of ChildViews, which then creates a new tab. When a new tab is created, it becomes the active tab, and this works fine. This method on the MainView is called from another