|
Member 8786335 wrote: sample application
Did you try searching CodeProject and see if any of the projects there help you at all. There is an extensive WPF section......
|
|
|
|
|
Josh Smiths MSDN[^] article goes through the whole process
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
|
You could try reading my article series on MVVM - it's a basic example of editing from a grid using MVVM with no framework (see my sig for a link)
|
|
|
|
|
Hi,
I have a silverlight project for file uploading. I have one problem.i.e., When uploading a file from browser, It doesn't displays the error. But when uploading a file from localhost, it displays the error.
For your reference : http://epstechno.com/metroepstechno/Default.aspx
Here you can check the problem what i mentioned above.
Please reply as soon as possible.
|
|
|
|
|
What error are you getting? You really need to supply this information.
|
|
|
|
|
I got file path error in local host, But when i am hosting that in server, it doesn't shows the error message please check http://epstechno.com/metroepstechno/Default.aspx this link
|
|
|
|
|
And what good would surfing to the link that doesn't fail do? If you've got an error in your local version, it should be easy enough for you to debug it.
|
|
|
|
|
how to make a interesting form in wpf c sharp application
|
|
|
|
|
|
So I have a data template... one of the properties is a bool? (nullable bool -- not a typo). When I go into the VS XAML editor, I see the prop fine and it says I can set false, true or {x:Null}. False & true work correctly. When I try to set {x:Null}. I get:
error MC4104: The property 'IsChecked' cannot be set as a property element on template. Only Triggers and Storyboards are allowed as property elements. Line 16 Position 60.
I guess the property is null by default, so I guess don't need to explicitly set it, just wondering why that doesn't work? And want to have an answer ready for users of my control.
|
|
|
|
|
Hi guys
Im quite new to WPF but have managed to a modular application working using Prism Unity.
What I want to be able to do is use animated transitions between views in modules. I came across the FluidKit but im struggling to get it to work within Prism.
Has anyone ever used the FluidKit successfully in Prism?
Any help will be highly appreciated!
|
|
|
|
|
I am starting a project that requires one person to stream their video to up to 8 others, and each of those 8 others stream back to the one.
I started this as a WinForm in C# with the form acting as sender, or receiver, but I am expending the thought to now use a server (either AWS or Azure of which I am signed up for both) to operate this as a hub & spoke type architecture instead of peer to peer.
I have experience in Silverlight and Lightswitch and thought it might be cool to use Lightswitch's new HTML server release, but there is usually something that stands in the way, whenever I take on a LS project, so then I thought a WebForm of WPF App might be better. I have some database needs and have used WCF/EF on other projects, and figured it would work well if I chose WPF since I did some RIA work before.
But, I have almost no knowledge of streaming video, and I am really stuck on what might be the best architecture to use.
Any thoughts along these lines, or outside the box are completely welcome. Thanks so much.
Dan "Paga Cession"
modified 14-Mar-13 15:47pm.
|
|
|
|
|
Hello,
Im using the
System.Windows.Controls.AutoCompleteBox
Here is my XAML code:
<Window x:Class="auotocomplitetrial.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkit="clr- namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
Title="MainWindow" Height="350" Width="525">
<Grid>
<toolkit:AutoCompleteBox Name="autocompleteBox" Height="50" Width="300"
ItemsSource="{Binding MyList}"
IsTextCompletionEnabled="True">
</toolkit:AutoCompleteBox>
</Grid>
</Window>
And here is my code behind the XAML:
public partial class MainWindow : Window
{
private List<string> myList;
public List<string> MyList
{
get { return myList; }
}
public MainWindow()
{
InitializeComponent();
myList = new List<string>
{
"Macedonia",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Mauritania",
"Mauritius",
"Mexico",
"Micronesia",
"Moldova",
"Monaco",
"Mongolia",
"Montenegro",
"Morocco",
"Mozambique",
"Myanmar"
};
}
}
When i ran this code the auto complete text box doesn't auto completes.
But when i uncomment this line:
And removed this one:
ItemsSource="{Binding MyList}"
From the XAML, the auto complete text box works fine.
What i'm missing?
Thanks
|
|
|
|
|
You don't appear to be setting the DataContext[^] anywhere.
In the constructor, after you've created the list, try adding:
DataContext = this;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am working on this[^] application.
The outter set of tabs is on the MainWindowView and the inner tabs are each on their own user control. IN the MainWindowViewMode I have a method called LoadView:
private void loadView(View View, _ArgsBase Args = null)
{
ViewInfo tabInfo = new ViewInfo { View = View, EntityId = 0};
if (TabManager.IsTabOpen(tabInfo))
{
TabManager.ActivateTab(tabInfo);
}
else
{
_DataEntryViewModelBase vm = null;
UserControl view = null;
string headerText = string.Empty;
switch (View)
{
case View.Dashboard:
headerText = "Dashboard";
vm = new DashboardViewModel();
view = new DashboardView();
break;
case View.JobCenter:
headerText = "Job Center";
vm = new JobCenterViewModel();
view = new JobCenterView();
break;
case View.CompanyCenter:
headerText = "Company Center";
vm = new CompanyCenterViewModel();
view = new CompanyCenterView();
break;
case View.MaterialsCenter:
headerText = "Materials Center";
vm = new MaterialsCenterViewModel();
view = new MaterialsCenterView();
break;
}
if (vm == null)
{
return;
}
vm.Load(Args);
view.DataContext = vm;
TabItem tabItem = new TabItem();
tabItem.Header = headerText;
tabItem.Content = view;
tabItem.Tag = tabInfo;
TabManager.AddTab(tabItem);
}
}
The obvious problem here is that the MainWindowViewModel is now coupled to all the child views. What is the right way to do this?
If it's not broken, fix it until it is
|
|
|
|
|
You'd have to know about the child views if you are creating them dynamically. What you DON'T have to know about is headerText and the vm.
Use a ViewLocator service or just specify it in the XAML. When the view is created, your VM will automatically be created and bound to the DataContext.
headerText should be specified in the XAML through data binding or hardcoded in the VM. The MainWindowViewModel certainly shouldn't know about it.
The real question is why you are getting a loadView method where you have access to the tab control itself. Big MVVM no-no.
TabControl should be in the main windows XAML and bound to an ItemsSource property. You shouldn't create tabs by hand, just add to the ItemsSource collection. That way you can do all the data binding in XAML.
|
|
|
|
|
Ok, I get the ViewLocator part. The rest I don't get.
I don't understand what you mean by this:
SledgeHammer01 wrote: The real question is why you are getting a loadView method where you have access
to the tab control itself.
The VM is trying to decide which view to open. Given the view type enum, how would the main window vm get a sub tab's view to open?
Can you point me to an example?
If it's not broken, fix it until it is
|
|
|
|
|
If you want to be all MVVMy, you would derive your child VMs from a common base class:
public ChildViewModel1 : ChildViewModelBase (which is derived from ViewModelBase or whatever)
{
}
public ChildViewModel2 : ChildViewModelBase
{
}
then in your MainWindowVM, you would have:
public ObservableCollection<ChildViewModelBase> ChildViews
{
}
in your MainWindowVM, if you wanted to open a view, you'd new up a ChildViewModel1 for example and stick it in the list. Closing a view by removing it, etc.
The MainViewView.xaml's TabControl ItemsSource would bind to the ChildViews prop. You can have a Title property in ChildViewBase that specifies the tab text.
You wouldn't use a ViewLocator in this implementation because you are going the other way. You only new up the VMs.
You would map the VM back to a view by defining DataTemplates that say for a type ChildViewModel1, I want to instantiate ChildView1 or whatever.
That doesn't happen automatically, so you'd either derive from TabControl or use an attached property where you monitor the TabControl ItemSource collection and look up the DataTemplate for the type of VM and new up the view and set its DataContext to the content of the tab (the VM) and then the tab's content to the view.
Very slick and MVVMy once you get it set up.
|
|
|
|
|
Ok, I et what you're saying, but how does binding the list of child views to the tab control item source actually render the view?
If it's not broken, fix it until it is
|
|
|
|
|
You would have a resource dictionary, which would define data templates for each view/viewmodel
<DataTemplate DataType="{x:type viewmodels:ChildViewModel1}">
<views:ChildView1/>
</DataTemplate>
You would add this resource dicyionary to your App.xaml file
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
modified 9-Mar-13 5:00am.
|
|
|
|
|
Ok, I see. I did this once a while back - back when I knew nothing about WPF. Someone showed it to me and I coded it. Didn't understand how it worked. It's all coming together now.
Thanks!
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: Thanks!
Glad to help!
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
By the way, do you know of any resources, book, articles, etc, that discuss this? I have been Googling, but I always get back fragments.
Thanks for your help.
If it's not broken, fix it until it is
|
|
|
|
|
Not really. Its mostly basic WPF concepts put together. Data templates, data binding, monitoring changes in a collection through INotifyCollectionChanged / OnItemsSourceChanged subscribing / unsubscribing to the collection changes.
As for doing the code that implements the add / remove tabs, you could do it via an attached property or deriving from the TabControl.
Concept is, if you get a new item in the collection, its going to be a ChildViewModelBase, it's going to be assigned to the tab content. So you'd do a GetType() on it and try to find a DataTemplate that is specified for that type, then you can create the child view automatically. You'd set that as the content and set the DataContext of the view as the VM.
|
|
|
|