According to Datatype,Dynamically Create Control & Using those Control - silverlight-4.0

I want to do a application in silverlight that contains follwing things
According to the datatype it receive from the class(which i am giving through wcf service)
it should create the control.
If it encounters string then a text box should be created dynamically.
If it encounters bool then a radiobutton should be created.
I want to acess those dynamically created controls.(as name is no static to refer in FindName())
How can i achive that.
Please help me with any related link or any code.
Thanks

In WPF, there's something called TemplateSelector, which does what you're asking for. In Silverlight, you have to write it yourself. This should help you.

Related

Showing Status-field as dropdown in Directus 7?

is there a way to make a Status-field display like an dropdown/select-box instead of radio-buttons? I have about 10 status' and I would like to display them as a dropdown instead.
I wasn't able to find anything about this in the documentation, did I miss something?
Thank you in advance!
Not the "core" status interface, but you can duplicate the code and create a custom one in a select instead. The new interface would go into the custom extensions directory in the API. Should be pretty straightforward.
https://docs.directus.io/extensions/interfaces.html

VB.NET How do I pass parameters to a class?

Relatively new to coding and have taken up lots of small projects to help learn the basics, and I have now set myself a challenge of a "bigger" one. Essentially I want to recreate the Message Box but with my own styling and customisable elements.
I have got the basics in a class and created it, however I want the class to have two options.
1) load all the details from an XML file for the message, I have done this and that works.
2) I want it to be like the standard message box where you can pass in parameters.
My question is, How can I achieve number 2.
I have tried adding details into the Show/Load subs but no luck, the only way around it I can see is with properties but that would take too long.
I want to be something like the below.
classname.show("message","tittle",icon,"buttons",imagefile,"caption")
However alot of my code is done in the load method as opposed to show, so it needs to be visible / accessible there.
Any help / advice would be appreciated.
Properties are definitely the way to go. It also makes sense: Conceptually, the message being shown is a property of the message box.
Your Show method would look like this:
Public Shared Show(message As String, title As String, ...)
Dim box as New MyMessageBoxWindow()
box.Message = message
box.Title = title
...
box.ShowDialog()
End Sub
In the Load method of MyMessageBoxWindow, you access these properties and configure the UI elements.

dynamic data display chart plotter in MVVM

I am trying to use d3 chart plotter in MVVM.
I am trying to use the code given by Ravi ( https://dynamicdatadisplay.codeplex.com/discussions/63633 ) in my project, but not quite sure how to use it properly.
It says "the property Linegraphs is not found in type ChartPlotter" when I try to use it in the XAML code.
What I did is add the LinegraphViewModel.cs to my project and make it the same namespace as my new project.
Anyone can advice me on what should I do in order to use the plotter successfully in my MVVM application?
Thank you so much!
Dynamic Data Display is a complex library with many different components. It not enough to pull a single class into your project. You need to reference the d3 .dll to your project to be able to use it's functionality, as well as using the dynamic data namespace in your xaml.
After adding a reference to the library to your project, you can set up the Dynamic Data Display namespace like this :
xmlns:dynamicDataDisplay="http://research.microsoft.com/DynamicDataDisplay/1.0"

Source code for WinRT UI controls publicly available?

Is the source for Windows Store (WinRT) UI controls publicly available? We would like to extend some of the controls and not have to start completely from scratch, like we can for SL and WPF. Googling and looking through SO doesn't turn up anything for Windows 8.
Thanks!
So unlike WPF, [WinRT-XAML] controls are written in C++/CX.
But, it sounds not so much like you want the source code as much as you want to derive from existing controls and extend or override their functionality. You know you can do this, right? It's easy enough and sounds like you will get the results you are asking in your question.
Something like this:
public class MonkeyTextBox : TextBox
{
public new string Text
{
get
{
return "Always Monkeys!";
}
set { /* do nothing */ }
}
}
This is my custom TextBox wherein I have replaced the base implementation of Text with my own. Granted, I hope your custom controls are better. Anyway, you can do this with almost every control, and you can add your own properties and events. Make sense?
Reference: http://blog.jerrynixon.com/2013/01/walkthrough-custom-control-in-xaml-isnt.html
But to answer your question: no, we have not released the source (yet). Hopefully, that will save you the time looking for it. Maybe someday we will - maybe.
Best of luck!

Simplest possible way to show two items NSTableView from code?

How I can create a code in XCode 4.2.1 what will create NSTableView and add just couple of items to it?
All what I wanted to do is:
1) Window where is NSTableView
2) I have an array of strings in NSArray which I like to show in that NSTableView
3) All of this should be done in code. So I don't want to learn how to add this action happen when you press button (I know already how to do actions when user click buttons etc), I just want that application launch -> draws the table where is those items from my array. That's it, nothing more.
And yeah I have understood that I do not add items to NSTableView directly. That is not the point in this question. I just mean that I want to show couple of items in that table but I have no and kind of clue WHERE I should add my data from my array.
I have tried to google for example pages for hours (just too many and have not find help) but I will always be stucked in the part when
a) I must do something in the Interface Builder and the images of the interface builder are from version 2.x or 3.x and I have 4.2.1 and it is totally different (new to XCode...). Surely I have drawn my TableView element to UI but I mean delegations etc. Are those necessary at all? Can those be made from source code?
b) Code just does not work anymore because language (Cocoa or Objective-C, I don't know) has changed and I don't know how and what I have to do to make it work on newest version of XCode.
c) There is too much different ways told: "use binding", "you must create new class what is NSTableViewDataSource" etc. I have no any kind of clue what is preferred way, is another way optional or it is "you should use this because another is going deprecated soon" or something.
So please, can somebody give help in step-by-step what I exactly have to do? Should I create some bindings? If so, how and where? Do I have to create DataSource component myself? Are those ways valid any more? If I have to, how I can create it? Create a new class and implement it as a NSTableViewDataSource and then use it? Is that way valid any more and if it is, can sombody show code what is as simple as possible?
I have also checked Apple Documentation page many many times, checked those example codes but there is just too much totally unrelated stuff that I just don't understand at this point so they are totally useless (I mean, I don't know what is required for this task, what are not etc.
I would be very happy if somebody can help short tutorial step-by-step what to do. I mean "step-by-step" like:
1) Create new project
2) Draw NSTableView in project
3) Create new class with this name
4) Write this code: blah blah blah
5) Create another class with this name
6) Write this code
7) Run and see those items from array in NSTableView using (bindings/datasource/whatever is preferred).
Thanks :)
Your tableview needs a datasource. Your datasource is a custom class, it implements the "NSTableViewDataSource" protocol. This protocol contains a few methods that you can use to tell the tableview what data you got.
this includes the objectValue ( the value of the NSCell that is displaying your data on the specified row, and a method that returns the amount of rows the tableview has ( the amount of items in your array ).
Here a tutorial I found by googling:
CocoaDev.com NSTableView tutorial
You can also implement the NSTableViewDelegate protocol which allows some greater control. Like what rows you can select, or some extra configuring of a custom tableview cell.
I must say that back in the day when I started developing desktop applications ( only had experience with web technologies ) that this design pattern confused me as well. Hope you will get your mind round it soon.