|
private void LoadDataVoidOnPageWichContainsYourComboBoxItemSource()
{
ComboUserData.CollectionChanged += ComboUserData_CollectionChanged;
}
void ComboUserData_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged("ComboUserData");
}
|
|
|
|
|
I'm going to deploy my WPF using ClickOnce. I want to have the users deploy from my server. But what do I need to do on my server to prepare? Do I need to set up a web site? I Googled on this but didn't find much.
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
|
You didn't understand my question
Do I need to do something on my server? Do I need to set up a site in IIS? What URL/IP do my users get?
If it's not broken, fix it until it is
|
|
|
|
|
No you need nothing in IIS unless you are hosting a website itself.
|
|
|
|
|
Hi Kevin. There are 2 alternatives to deploy a WPF application with click once. Create a shared folder on your server, where everyone who needs to install the application has access to. The in your application properties, under publish, you just set the Publishing Folder Location to point to this folder, and leave Installation Folder URL blank. Once you publish it, a setup file will be available for users to install it on their machine.
The second way I do it in IIS, is to create an FTP site, and a standard website. I then use the ftp site as the Publishing Folder Location, and the standard web site as the Installation Folder URL. I then publish it via ftp, and the users can browse to the web site url and install it from there. When you create the web site, you do not need to create any pages or anything, Visual Studio does all this for you when you publish.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
My TreeView:
<controls:TreeViewEx BorderThickness="0"
Margin="5"
ItemsSource="{Binding Nodes}"
IsManipulationEnabled ="True"
Visibility="{Binding ShowTree, Converter={StaticResource visibilityConverter}}">
<controls:TreeViewEx.Resources>
<SolidColorBrush Color="Transparent" x:Key="{x:Static SystemColors.HighlightBrushKey}"/>
</controls:TreeViewEx.Resources>
</controls:TreeViewEx>
and the HierarchicalDataTemplate:
<HierarchicalDataTemplate DataType="{x:Type models:JobSummaryModel}"
ItemsSource="{Binding Path=Nodes}">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextBlockEx Grid.Column="1"
FontSize="12">
<Hyperlink Style="{StaticResource linkStyle}"
Command="{Binding SelectedNodeCommand}">
<TextBlock Text="{Binding Caption}"/>
</Hyperlink>
</controls:TextBlockEx>
</Grid>
</HierarchicalDataTemplate>
I'm getting a binding error in the outout window. The SelectedNodeCommand is on the ViewModel. How do I bind the hyperlink to it?
Thank you
If it's not broken, fix it until it is
|
|
|
|
|
You can't bind to the VM from a standalone DataTemplate as there is no DataContext there.
|
|
|
|
|
Ok, so what's the way to handle the user clicking the link?
If it's not broken, fix it until it is
|
|
|
|
|
One way to do it is to bind back up the data template hierarchy using FindAncestor to hook into the DataContext there. It's a bit of a hack though.
|
|
|
|
|
I was going to say this... the other option is to inline the HierarchialDataTemplate into the control XAML itself rather then putting it in the resource section as a standalone template.
|
|
|
|
|
Could you show me how this is done?
Thank you
[EDIT]
I thought this would do it. I compiles & runs with no binding errors, but nothing happens when I click a link:
<Hyperlink NavigateUri="{Binding Caption}"
Foreground="#0C2DAA"
Style="{StaticResource linkStyle}"
CommandParameter="{Binding}"
Command="{Binding Path=DataContext.SelectedNodeCommand,
RelativeSource={RelativeSource FindAncestor,
AncestorType={ x:Type views:JobListView}}}">
<InlineUIContainer>
<TextBlock Text="{Binding Caption}" />
</InlineUIContainer>
</Hyperlink
>
If it's not broken, fix it until it is
|
|
|
|
|
Correct syntax is something like:
{Binding Path=ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=GridViewColumnHeader}}
{RelativeSource Mode=FindAncestor, AncestorType=ctrls:ListViewEx}
All the ones I have just say AncestorType=whatever:whatever, none use {}'s and x:Type... you can try that... the other option is inlining:
<TreeView>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
|
|
|
|
|
This works, although I don't pretend to completely understand it
<HierarchicalDataTemplate DataType="{x:Type models:JobSummaryModel}"
ItemsSource="{Binding Path=Nodes}">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Image Source="/FMG.UI.WPF.Shared;component/Media/Images/job_72.png"
Grid.Column="0"
Height="16"
Width="16"
Margin="0,0,3,0"/>
<TextBlock Grid.Column="1">
<Hyperlink NavigateUri="{Binding Caption}"
Foreground="#0C2DAA"
Style="{StaticResource linkStyle}"
CommandParameter="{Binding}"
Command="{Binding Path=DataContext.SelectedNodeCommand,
RelativeSource={RelativeSource FindAncestor,
AncestorType={ x:Type views:JobListView}}}">
<InlineUIContainer>
<TextBlock Text="{Binding Caption}"
FontSize="12"/>
</InlineUIContainer>
</Hyperlink>
</TextBlock>
</Grid>
</HierarchicalDataTemplate>
If it's not broken, fix it until it is
|
|
|
|
|
I want to create dynamically textbox and also bind the contents of these textbox to view model. Suppose I want to create more than one textbox depending on user input(number of textboxes).
Please help me regards this, I am new to MVVM pattern.
modified 7-Nov-13 5:49am.
|
|
|
|
|
1 texbox - create the textbox inxaml and bind the visibility property to the VM
Multiple textboxes - use a collection control (listbox) and bind the ItemsSource to a collection in the VM.
You need to learn the functionality of the controls you have available to you.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks Mycroft Holmes....
Creation of one textbox is working, but I have to create multiple textbox. I am new to MVVM, please post one sample code to create multiple textbox.
|
|
|
|
|
Please stop. This is not the way to learn MVVM. Right now, you are tackling MVVM in a very haphazard fashion and getting your information through answers on a forum is not the right way to learn the basics. There are many excellent resources available to learn MVVM from, I suggest that you pause and actually use these resources. You can even get free training inside Visual Studio[^].
|
|
|
|
|
I am new to MVVM, facing problems so I am asking my problem. And whatever you gave the way to learn that is also not for beginner, its a complex way.
|
|
|
|
|
Utter rubbish. The training is designed for complete beginners. You are wasting your time and ours by trying to learn this way. If you actually took the time to do the training, you would learn much quicker and much more effectively.
|
|
|
|
|
Thanks a lot Pete O'Hanlon.
|
|
|
|
|
Hi,
I'm on the design phase of a WPF desktop application. It has a MainWindow with its WindowState as Maximized and also a Menubar. I want the Mainwindow to display a set of controls when the user selects each menu item, rather than opening another window. Is this possible?
Thanks
|
|
|
|
|
Yes this is possible.
Using the MVP(model view presenter)pattern will achieve this for you.
You best starting point is to do the exercises in Sams-Teach-Yourself-WPF-Hours[^] - i.e read the book and follow the exercises as the book progresses.
Your question hints that you are fairly new to WPF - WPF being something that you cannot generally pick up by playing around with it like winforms I suggest you get started on your reading and good luck
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
It sounds like what you want to do is to have a set of user controls, each of which is loaded depending on a menu option selection.
the Simplest (but probably least efficient depending on memory footprint, number of menu options etc.) is simply to place all of the user controls on teh window, then make them invisible until a menu option is selected.
You could also load the user controls dynamically when a menu option is selected. (see here[^] for one of many examples of how to do that.
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
Hi,
Please help me regards this issue, there are more than one textboxes, I have to bind text of all textboxes to a list or observable collection in ViewModel.
|
|
|
|