Все вопросы: [wpf]

6 081 вопросов

9
голосов
3ответов
9855 просмотров

WPF Grid - Auto sized column not collapsing when content Visibility set to Visibility.Collapsed

I have the following simpl WPf grid, two columns, a button in each column, the first column auto sized and a splitter to allow column resizing. An event handler is set up on the splitter MouseDoubleclick event. When the splitter is doulble clicked the button in the left column is collapsed. Now...

0
голосов
2ответов
333 просмотров

User Control Not Rendering When Used as a DataTemplate?

I have a usercontrol which I want to use as a DataTemplate in a Listbox. This works: <ListBox> <ListBox.ItemTemplate> <DataTemplate> <Grid x:Name="Grid" Height="100" Width="880" Background="LightGray"> <Grid.RowDefinitions> <RowDefinition...

2
голосов
2ответов
2250 просмотров

Can I pass data from Winforms to WPF Control?

I have a winforms app but I would like to introduce a WPF user control into the app as a taster for further WPF implementation. This control needs to receive from its Host a single piece of information, a string. How can I pass this down from the Winforms app to the hosted control? Or, indeed, ...

6
голосов
2ответов
2181 просмотров

Conditional Data Templates in WPF

How would it be possible to choose a different datatemplate accroding the a field in the data binding source? I would have 2 different DataTemplates <DataTemplate x:Key="DataTemplateLabel"> <Label Width="60" Height="25" Background="Red"> <TextBlock Text="{Binding Path=Name...

0
голосов
1ответов
462 просмотров

get RibbonCommand Name from sender Object that is executed

How to get the Label of Ribbon command that is executed. Information is present in sender object but how to cast it in RibbonCommand and then I can get that command name private void RibbonCommand_Executed(object sender, ExecutedRoutedEventArgs e) { RibbonCommand rbnCmd = sender as RibbonCo...

47
голосов
8ответов
53314 просмотров

How can I move a WPF Popup when its anchor element moves?

I have a Popup defined like this: <Popup Name="myPopup" StaysOpen="True" Placement="Bottom" PlacementRectangle="0,20,0,20" PlacementTarget="{Binding ElementName=myPopupAnchor}"> <TextBlock ... /> </Popup> I have added event handlers to the myPopupAncho...

2
голосов
2ответов
1250 просмотров

WPF WrapPanel Items don't scroll one by one

Someone help me out, please. I set a WrapPanel in a ListBox ItemsPanelTemplate. Also, I already set the ScrollViewer.CanContentScroll="True". But why the listbox items are not scrolling up/down by ITEM one by one? The scroll style is still by PIXEL. Can anyone help me? <Grid> <L...

1
голосов
1ответов
3064 просмотров

Transpose a Collection

I've a list of different sizes of a T-Shirt, e.g. S, M, L. Since this might change for T-Shirts (sometimes we just have e.g. M, L), we load this into a List sizes. Since most DataGrids (xamDataGrid, WPF Toolkit DataGrid) need Properties for binding to the Columns, I'd like to transpose somehow m...

1
голосов
2ответов
1331 просмотров

How to load file icons in a background thread [WPF]

my code extracts file icons(or even thumbs). however if i have many files it may take a while. I've tried to use background thread to load icons. Bitmap created from icon extracted form file and stored in list. It seems that for each native bitmap it handle exist only in owner thread (that is i...

0
голосов
2ответов
922 просмотров

How to implement Touch Screen functionality in WPF

I am using WPF 3.5 on Vista Machine. Can someone please let me know how to implement touch screen functionality on this. A demo example will be really helpful. Thanks, Sachin

5
голосов
1ответов
1635 просмотров

WPF: Can't drop dragged data onto an ItemsControl

I have the following XAML: <DockPanel x:Name="OverViewContainer" AllowDrop="True"> <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right"> <uicommon:Toolbar DataContext="{Binding Commands}" /> &lt...

1
голосов
2ответов
1212 просмотров

How can I desaturate selected rows when DataGrid is out of focus?

The normal convention for UI controls is for selected text, items, or rows to be brightly colored (e.g., bright blue) when the parent control is in focus and desaturated/dim (e.g., pale blue) when the control is out of focus. In contrast to the ListView/GridView, the WPF DataGrid control does no...

2
голосов
1ответов
3041 просмотров

Set System.Windows.Controls.WebBrowser's content to a static HTML literal?

I want to set up inline content of a WPF WebBrowser control: <WebBrowser> <html> <body><b>Inline content.</b></body> </html> </WebBrowser> Or alternatively: Dim wb As New WebBrowser wb.Content = "<html><body><b>...

1
голосов
2ответов
5857 просмотров

WPF how to show an Image.Source (BitmapSource) pixel position?

Let's suppose I've got an image which shows its source in a scaled way, how could i use a MouseMove event to show in a label or textblock the pixel position in which the cursor is? (I need the pixel coordinates not the coordinates of the image relative to its size) Thanks in advance.

3
голосов
1ответов
2945 просмотров

Problem with text input in textbox control

I'm working in a WPF project, which basically is a class library project that implements the MVVM pattern. For clarity purposes I'm gonna say that I just have a single window with a single textbox control on it. Now, I'm adding this dll to another project, which is a Windows Forms project, and ...

4
голосов
1ответов
2812 просмотров

WPF: DataBinding a ListBox where each item is a Tab Stop

I just built a WPF form that contains a ListBox. The ListBox has bound to it a list of TextBox controls. I need to make each TextBox control a TabStop so that a user can hit tab, type in a number, hit tab again and type in the next number, etc. Problem is, the ListBox itself catches the tab then...

3
голосов
2ответов
9760 просмотров

Setting Canvas to a control template?

I have a Canvas in a ResourceDictionary xaml file like so: <Canvas x:Key="Icon"> <Path ... /> <Path ... /> </Canvas> In my code-behind I load this icon using LayoutGrid.Children.Add(FindResource("Icon") as Canvas); And this works fine. Now I want to create ...

0
голосов
2ответов
5346 просмотров

WPF Putting a Button on a Label

I've got a listbox of Labels, each bound to a LabelName and LabelColor. I want to add a small button that resembles an "X" and attach it on the right side of the Label. I want it to look seamless, like the X is very non-intrusive. Any ideas how to do this? The stuff between the <Label.ContentT...

1
голосов
3ответов
3476 просмотров

WPF - Drag & Drop on Listbox ITEM

I want to drop something not on the whole ListBox, but on a specific ListBoxItem. I'm handling the ListBox' Drop event - how can I find out, on which item the mouse is pointing?

1
голосов
2ответов
1851 просмотров

databinding to XML in XAML: How to append new XmlNode?

all I found so far about databinding to XML always only seems to be binding to a fixed XML structure. Would be nice, if anyone could point me in any direction, everything I tried so far seems very awkward. This is what I would like to do: Binding the Checked state of a Checkbox to a node within...

6
голосов
4ответов
2168 просмотров

Implementing multiple screens in an Application

Weird question, but one that puzzles me a bit. In the old days when we had Terminals and DOS, applications generally only had one "window", and that was a fullscreen one. When people switched functions, there was no concept of opening a new window, but instead the content of the main window was o...

4
голосов
3ответов
1391 просмотров

How do I see the value of a DependencyProperty in WinDbg?

Using WinDbg and trying to debug a Silverlight application for memory leaks, I come across properties on my objects that are implemented as a DependencyProperty - and when I dump the object in the debugger (WinDbg) I can see the property - that is, I can see the actual static field. How do I see...

0
голосов
1ответов
1684 просмотров

How to call a Public Sub function of a window from another Window

I have A Wpf window with a Public Sub function(Window1). I need to execute that function from another window. Something like this: Private Sub Window2_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Window1.Loaded Dim Window1 As New Window 1 Window1.func...

0
голосов
2ответов
339 просмотров

How can I speed up the animations when using FluidKit?

I've using FluidKit in a WPF application and would like to speed up the animations. SlideTransition slideTransition = Resources["SlideTransition"] as SlideTransition; slideTransition.Direction = Direction.LeftToRight; slideTransition.Duration = new Duration(new System.TimeSpan(1000)); //does not...

1
голосов
2ответов
3527 просмотров

ComboBox with IEnumerable<brush> as ItemsSource and SelectedItem exception</brush>

I have this issue with ComboBox that uses IEnumerable&lt;Brush&gt; as ItemsSource; the problem lies when I (programmatically) try to set SelectedItem. Here is the code that describes the problem: private readonly List&lt;Brush&gt; colors_; private Brush white_; ViewModelConstructor() { colo...

1
голосов
2ответов
1551 просмотров

Prevent ListBox from focusing but leave ListBoxItem(s) focusable

Here is what happens: I have a listbox with items. Listbox has focus. Some item (say, 5th) is selected (has a blue background), but has no 'border'. When I press 'Down' key, the focus moves from ListBox to the first ListBoxItem. (What I want is to make 6th item selected, regardless of the 'bord...

0
голосов
1ответов
953 просмотров

WPF Sidebar style drag and drop

I'm trying to write a WPF control that has similar functionality to the Windows Sidebar. The functionaly I would like to replicate is the drag and drop ordering. When dragging an item the other items move out of the way to show you where the item will end up when dropped. Has anyone else had to...

4
голосов
4ответов
17040 просмотров

How to change a WPF window backgroud with a data trigger?

I want to change the background color of our apps main window when a property changes. We have a business date that can be changed and I want to change the window background when it has changed from expected. I've set up a property to tell this. But can I set a style datatrigger on a window th...

0
голосов
1ответов
253 просмотров

Nested RichTextBox

I am creating a small custom scientific editor using RichTextBoxes. User can insert a 'formula' UserControl which itself contains one or more RichTextBoxes, allowing insert more 'formula' controls - this replicates minimal functionality of MathType. When I insert the UserControl, it shows up alr...

0
голосов
1ответов
1457 просмотров

WPF Remove Margin Animation Programmatically

How do I remove the margins of two sides of a stackpanel in an animation storyboard so it looks like the stackpanel has moved from the code behind? I need to do it in the code-behind because the number of stackpanels i use this animation on differs at runtime. Thanks :o)