wpf-controls

How to get the Document's Title from a Web Browser control in wpf

坚强是说给别人听的谎言 提交于 2020-01-23 12:12:47
问题 I have created a Web Browser control in a TabControl.I want to set the Header of the TabItem to the Document's title of the Web Browser. I used the following code in the Navigated Event of the WebBrowser dynamic doc = tabBrowser.Document; //tabBrowser is the name of WebBrowser Control tab.Header = doc.Title; //tab is the name of the Tab Item But this piece of code doesn't work as it should.The header changes only for a few site. How can i set the Header of the tabItem to the Document's Title

Tooltip on scrollviewer in documentviewer in case of deferred scrolling

南笙酒味 提交于 2020-01-23 09:45:09
问题 I want to show the tooltip on my scrollviewer on page scrolling which shows the current page number in it which i asked here- Tooltip on scrollviewer in documentviewer. I have implemented the answer after making some changes in the proposed solution but i face some problem. If i write this in my scroll_changed event if (Mouse.LeftButton == MouseButtonState.Pressed) it works perfectly fine but if i have a deferred scrolling enabled on my custom document viewer, the popup(tooltip) never appears

WPF automatic resize font until it fits within parent control

混江龙づ霸主 提交于 2020-01-22 07:04:33
问题 I have a user control who's root element is a Grid. I also have have a ContentControl that serves as a placeholder for some text that is filled when data is loaded. This control can be moved around within the user control and so it's position can be anywhere. If the text is too long to fit within the root Grid of the user control, I want to reduce the font size of the ContentControl until the text fits. My problem is that I can't seem to find an event that I can handle to do this process. I

WPF automatic resize font until it fits within parent control

醉酒当歌 提交于 2020-01-22 06:58:30
问题 I have a user control who's root element is a Grid. I also have have a ContentControl that serves as a placeholder for some text that is filled when data is loaded. This control can be moved around within the user control and so it's position can be anywhere. If the text is too long to fit within the root Grid of the user control, I want to reduce the font size of the ContentControl until the text fits. My problem is that I can't seem to find an event that I can handle to do this process. I

Notifying ViewModel of Property change from Model class

非 Y 不嫁゛ 提交于 2020-01-21 13:39:05
问题 In my WPF application, I have my TreeView IsSelected property binded to a property in my Model class. So the selected Item is set in the Model class. I need to notify my ViewModel whenever the selected Item is set/changed. How can I do that? Thanks in advance. 回答1: I guess your Model instance is part of your ViewModel... First, yes it should implement INotifyPropertyChanged. If you also want your ViewModel to get notified, then you ViewModel should subscribe to that event. public class Model

Getting the top left coordinates of a WPF UIElement

牧云@^-^@ 提交于 2020-01-21 06:24:05
问题 I am working on extending the Microsoft resize Adorner example and need to be able to reposition the element after say the bottom left drag handle has been dragged. So if I have a textbox of say 150 wide, 35 high postitioned on my form, and the bottom left drag handle changes the width to 200 wide, the right hand of the text box remains unchanged but the left hand edge moves to the left. So I need to know the top left coordinates of the UIElement. I have tried Canvas.GetLeft and Canvas.GetTop

Getting the top left coordinates of a WPF UIElement

百般思念 提交于 2020-01-21 06:23:39
问题 I am working on extending the Microsoft resize Adorner example and need to be able to reposition the element after say the bottom left drag handle has been dragged. So if I have a textbox of say 150 wide, 35 high postitioned on my form, and the bottom left drag handle changes the width to 200 wide, the right hand of the text box remains unchanged but the left hand edge moves to the left. So I need to know the top left coordinates of the UIElement. I have tried Canvas.GetLeft and Canvas.GetTop

Getting the top left coordinates of a WPF UIElement

时光毁灭记忆、已成空白 提交于 2020-01-21 06:23:04
问题 I am working on extending the Microsoft resize Adorner example and need to be able to reposition the element after say the bottom left drag handle has been dragged. So if I have a textbox of say 150 wide, 35 high postitioned on my form, and the bottom left drag handle changes the width to 200 wide, the right hand of the text box remains unchanged but the left hand edge moves to the left. So I need to know the top left coordinates of the UIElement. I have tried Canvas.GetLeft and Canvas.GetTop

Force a custom WPF Control to resize correctly

China☆狼群 提交于 2020-01-20 03:34:53
问题 I have written a WPF user control and part of it involves dynamically adding elements to a canvas which effects the height of said canvas. The canvas is nested within a grid. When I dynamically add my elements the height of the canvas changes, but the canvas ends up extending beyond the edge of the overall control rather than causing the control to resize and make itself taller. How can I force the control to resize correctly? I get the feeling I need to either call or override Measure or

WPF treeview item background over entire row

五迷三道 提交于 2020-01-19 14:15:48
问题 i am writing one app and i need to set background under entire row by items. I found some inspiration in here but i cannot get idea how to get Border background value in template (the problem is a bit more complicated:) My problem is that in the treeview are 2 types of "data" (files and folders). User can modify the background under files and folders. Right now i have the background on textblock, but it seems horrible and i want to have the background over entire row (i think it will looks