Within my custom WPF control I want to get a containing Window or Page. Window.GetWindow() method works fine when control is in a windowed app but when it's in the XBAP app in a browser it returns browser window instead of the page.
Is there any other way to do this?
...
Hi.
I have a question regarding the MVVM design for C#/WPF. I've had a look at several demo applications, but they didn't really handle my problem.
My application consists of objects that contain other objects. Much like in a parent - children relationship.
My question now is:
does the children attribute have to be a ViewModel
and ...
I want to create two grids in the WPF Page. One grid need scrollbar or scroll viewer. Another grid is static.The grids are placed one by one in the page. How to create and set the scroll in first grid.? plz explain me.
...
Hi,
I am confused. Maybe you can help me :)
I have been following the guidance of CAG and found the MVP pattern very natural to me.
Suppose I have a UI-ready Model (for example : implements INotifyPropertyChanged), I use the presenter to bind this Model to a view (presenter knows an interface of the view), keeping my Code-Behind as sma...
Hi,
I have a user control which displays the currently logged in user's name. I have bound a TextBlock in the control to the UserId property of a User obejct in my application.
The issue I have is that the User object my binding has as a source changes each time a new user logs in.
I can think of a solution where I fire an event when ...
Hi all,
I have a Path (a star figure):
<Path x:Name="NiceStar" StrokeThickness="10" Stroke="#ff000000" StrokeMiterLimit="1" Data="F1 M 126.578613,11.297852 L 162.373535,83.825684 L 242.412598,95.456055 L 184.495605,151.911133 L 198.167480,231.626953 L 126.578613,193.990234 L 54.988770,231.626953 L 68.661621,151.911133 L 10.744629,95.45...
I have a WinForms form (call it 'MyForm') that hosts some WPF UI (via ElementHost). I show this form on a separate thread from the main UI thread.
I want 'MyForm' to remain on top of the main application window, so I am showing the form using the Show(IWin32Window) overload of the Show method, with the passed-in IWin32Window being the m...
Hi,
What's the best way to tell my application that the file has been modified and that it should ask the user for a filename? Is there a class for that or do I write that all that logic by hand?
Thanks!
...
Something strange is going on with ObservableCollection.
I have the following code:
private readonly ObservableCollection<DisplayVerse> _display;
private readonly ListBox _box;
private void TransferToDisplay()
{
double elementsHeight = 0;
_display.Clear();
for (int i = 0; i < _source.Count; i++) {
DisplayVerse verse = ...
I've got a WPF application.
On the left side there is a stackpanel full of buttons.
On the right side there is an empty dockpanel.
When user clicks a button, it loads the corresponding UserControl (View) into the dockpanel:
private void btnGeneralClick(object sender, System.Windows.RoutedEventArgs e)
{
PanelMainContent.Children.C...
Hi all
I have a UserControl with ComboBox that based on XML data:
<Root>
<Node Background="Yellow" Foreground="Cyan" Image="1.ico" Property="aaaa" Value="28" />
<Node Background="SlateBlue" Foreground="Black" Image="2.ico" Property="bbbb" Value="2.5" />
<Node Background="Teal" Foreground="Green" Image="3.ico" Property="cccc" Value="4.0...
I am trying to get the effect of "dimming out the whole window and all controls on it".
The window and everything on it also needs to be disabled.
The problem is that when button is disabled, it doesn't seem to let you change the Background color.
Is there a way in WPF to change the background color of a button even though it is disa...
Suppose I have string Name and Image Photo as properties of a class in my DataContext. I need to bind them to controls is a DataTemplate.
I thought this would work but it doesn't:
<Image Source="{Binding Photo}"/>
Why not? Should I my Photo have another type? (BitmapImage perhaps?)
How can I bind an Image control to an Image proper...
Getting into the first serious WPF project. It seems like there are a lot of basic controls flat out missing. Specifically, I am looking for the Numeric UpDown control. Was there an out of band release that I missed? Really don't feel like writing my own control.
I do not want to use the WindowsFormHost and plop a WinForm ctl on i...
Given that you have a control that fires a command:
<Button Command="New"/>
Is there a way to prevent the command from being fired twice if the user double clicks on the command?
EDIT: What is significant in this case is that I am using the Commanding model in WPF.
It appears that whenever the button is pressed, the command is execu...
Application:
WPF Application consisting of a textbox on top and a listbox below
Users type a string in the TextBox to find employees, and search results are displayed in the ListBox
ListBox uses DataTemplates to display elements (shows employee name, department, phone and a thumbnail picture.)
Implementation:
At application startu...
How does ListCollectionView.AddNew determine the type of object it creates, and how could one affect it?
I have a hierarchy of a few types (Base, DerivedA, and DerivedB), and currently my WPF Toolkit DataGrid creates DerivedA objects (why, I don't know -- probably because almost all the data in the grid is of that type), but I'd like it...
I've got a WPF window with SizeToContent="Height". This window contains an <Expander /> that displays a list of recent activity. What I'd like is when the expander is expanded the window grows in size proportionally. When hidden the window again resizes proportionally. If the window is resized the expander and it's contained list view sh...
I have a bool value that I need to display as "Yes" or "No" in a TextBlock. I am trying to do this with a StringFormat, but my StringFormat is ignored and the TextBlock displays "True" or "False".
<TextBlock Text="{Binding Path=MyBoolValue, StringFormat='{}{0:Yes;;No}'}" />
Is there something wrong with my syntax, or is this type of ...
I need to programatically show/hide a MenuItem, what would be the best way to do this?
...