Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

Jurgen Rohr

@Jurgen Rohr
About
Posts
15
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • WCF Service list
    J Jurgen Rohr

    Hi, "List" is a generic type which means, it provides functionality, which can be applied to abitrary (other) types. That's why you can't have "List" as the return type of a webservice (or just any method), but List<T> where "T" is another type. If you have two instances of List<T> and the involded "T"s are different, the List-types are not convertible (neither implicitly nor explicitly). So, if you have

    List lstUser = new List();

    you can't assign the result of

    List lstEmployee = EmployeeSrvc.GetEmployeeDetails();

    This is true for .Net until 3.5; in .Net 4 MS has made some improvements. Just search for "covariance"/"contravariance". If "Emplpoyee" and "User" have the same properties, you should just use one class (e. g. "Person"). Another possible solution could be to loop through the results of the service (employees) and create and add new users. Cheers Jürgen

    If this answer saves you some time, please spend a bit of it to vote.

    WPF csharp help wpf wcf tutorial

  • Setting a textbox based on listbox selection.
    J Jurgen Rohr

    Hi, you must convert the SelectedItem of the ListBox into the string you need. You can do this by binding it to another property (of your viewmodel) and in the new property's setter, you can transfer the converted string-value to your TextBox.Text-property. Alternatively you must code the SelectionChanged-event of the ListBox. The type of the SelectedItem depends on the given Items (sounds a bit stupid, I know). If you fill the ListBox at designtime, you will probably have something like

    <ListBox ... >
    <ListBox.Items>
    <ListBoxItem Content="one" />
    <ListBoxItem Content="two" />
    <ListBoxItem Content="three" />
    </ListBox.Items>
    </ListBox>

    In this case, the SelectedItem is of type ListBoxItem. If you e. g. provide a List<string> as ItemsSource, you get a string as SelectedItem. As mentioned by Abhinav S you might want to consider using the IsSynchronizedWithCurrentItem property. Cheers Jürgen

    WPF csharp wpf question

  • TreeView Binding Problem
    J Jurgen Rohr

    Hi, from your structure I assume your intention is to have several Action/Object-pairs under each condition and to accomplish that, you created two lists of identical length: one of Objects and one of Actions. You should replace the two lists with one list of a combined class like:

    public class CombinedClass
    {
    public RuleObject { get; set; }
    public RuleAction { get; set; }
    }

    Then it should be almost self-solving!? But maybe, I got your structure wrong. Cheers Jürgen

    WCF and WF wpf wcf xml help question

  • Can I set a binding property of TextBox with Styles? [modified]
    J Jurgen Rohr

    Hi, yes, you can. And it's just as simple as you can imagine. Where you now write

    <TextBox
    ...
    Text="{Binding ...}" />

    make it into a style with

    <Style
    ...
    <Setter
    Property="Text"
    Value="{Binding ...}" />
    </Style>

    I just used "UpdateSourceTrigger" and it works; so why would the other binding-parameters refuse... Cheers Jürgen

    WCF and WF wpf wcf question

  • WPF: Add Controls To Grid At Runtime
    J Jurgen Rohr

    Hi, don't know, if this one's still open, but if so, I can give you two hints: 1. your code isn't working. You can't add one control two times (results in an ArgumentException) 2. if you replace the beginning of your method (I mean everything until but not including "Grid.SetRow(...") with

    Button CurrentControl = new Button();
    CurrentControl.Content = "Hello World";

    the Button shows up as expected and everything here is fine. The error your seeking seems to lurk in the code not provided. Cheers Jürgen

    WPF csharp css wpf question

  • Strange Container problem
    J Jurgen Rohr

    Yep, it's Germany; and the dots are a neverending source of hassle. You wont believe how many websites, software ... and hence programmers think, if their tests covered a..z they're ready for unicode. I wonder, what asian people could say about that... ;) Ooops, I thought it was John (& Jane) Doe, but I got what you meant ... and that's why I supposed you give the Canvas a more 'speaking' name. BTW: Why do you use a Canvas with an ImageBrush background? A sole Image would do the same. Regards Jürgen

    WCF and WF css wpf com docker help

  • Border as control
    J Jurgen Rohr

    Hi, your problem has nothing to do with WPF; it's about C# fundamentals. You might want to take a look at the inheritance tree. There you can see why you get that error. Neither Border nor Image derive from Control. To be honest (really no flaming or insulting intended): The best advice I can give you, is to take a good book about C#- or .Net basics and a little time. In case I'm mistaken, I'll give you some clues (which hopefully will only help you if I'm mistaken): 1. ugly solution: use the VisualTreeHelper class. 2. ugly solution: use a common ancestor 3. good solution: use data binding Both ugly solutions (as well as the provided code) imply that you will never use your own controls - or you'll get an endless list of "if ... GettYpe()". Solution #2 (as well as the provided code) still has to deal with the stacking of WPF objects (you will find the Border inside the Canvas, but you will not find the TextBox inside the Border). Unfortunately I can't recommend any C# book, but if it's up to WPF (and accordingly data binding), I've learned a lot from "WPF unleashed". Cheers Jürgen

    WPF help tutorial

  • Strange Container problem
    J Jurgen Rohr

    Hi, sorry. I didn't want to ignore your question, but the proposed solution seemed so simple and yet right to me, that I oversaw, there might be further points of interest. So, let's go through it a bit more detailed: Your (original) code contained two flaws, that prevented it from working. 1. As you've found yourself: The PropertyPath must be built with "(Canvas.RenderTransform).(ScaleTransform.ScaleX)" - not ScaleXProperty. That is right for the code behind too. 2. (harder to catch) When you construct the Canvas (and implicitly the RenderTransform) it is created as a "TransformGroup" (see the 'usual' XAML - this is, what will be constructed by "Canvas myCanvas = new Canvas();"):

    ...
    <Canvas.RenderTransform>
    <TransformGroup>
    <ScaleTransform CenterX="330" CenterY="0" ScaleX="1" ScaleY="1" />
    <SkewTransform
    ...
    </TransformGroup>
    </Canvas.RenderTransform>
    ...

    As it is immutable, you must re-init the RenderTransform with

    myCanvas.RenderTransform = new ScaleTransform(1, 1, 330, 0);

    Otherwise the Default(=Matrix)Transformation can not be cast into a ScaleTransformation and just nothing happens. Finally you made one good point: using name registering - espescially with such a funny name - instead of data binding does not seem elegant to me either. But it's your solution so be it your choice. My last proposal: make it "MyCanvas" instead of "JohnDow"... Regards Jürgen

    WCF and WF css wpf com docker help

  • How To Align These Button Groups
    J Jurgen Rohr

    Hi, maybe you should have given us the surrounding container and a hint whereto the buttons should align ... so, I'll make a guess. If you want each whole button-block to be aligned as described in a container of arbitrary (horizontal) size, you must replace the outermost StackPanel with a Grid. The Grid must have three columns with "Auto", "*" and "Auto" as the respective widths. As you already provided the correct alignments, the three remaining StackPanels will be arranged as you wish. BTW what do you intend by giving the "VericalAlignment" of the buttons? Cheers Jürgen

    WCF and WF question css tutorial

  • How do I draw a line in a flow document?
    J Jurgen Rohr

    Hi, try this

    <FlowDocument>
    <Paragraph>
    <Run
    Text="lorem ipsum dolor" /> "
    </Paragraph>
    <BlockUIContainer>
    <Rectangle
    Fill="Black"
    Height="1" />
    </BlockUIContainer>
    <Paragraph>
    <Run
    Text="lorem ipsum dolor" /> "
    </Paragraph>
    </FlowDocument>

    or the respective code. The "BlockUIContainer" should get you, where you want to. Cheers Jürgen

    WCF and WF question visual-studio

  • Strange Container problem
    J Jurgen Rohr

    Hi, maybe you should consider binding the Canvas.Background instead of using a static resource. Then you can leave everything in the XAML as it is (you can even eliminate the Grid as it is not needed). Load the BGBrush into a bound property and then do as you do right now; if necessary, you can bind the sizes of the Canvas/Window and set the properties according to the loaded image. Cheers Jürgen

    WCF and WF css wpf com docker help

  • How do you send a refresh message to a WPF grid or canvas?
    J Jurgen Rohr

    Hi, although I'm not sure about your saying "...code that sends a line to the display...", I'll try to answer, as far as I've understood: The "UIElement" class has a method "InvalidateVisual", which will force a complete new layout pass; Grid and Canvas derive from "UIElement" and thus have this method available. But this is a rather expensive (considering performance) way to 'refresh the screen'. If you have a TextBlock or TextBox for the "line" in your container (Grid or Canvas), you could give it a name (in the VS designer) and access the "Text" property from code. This would work just as in WinForms. This assumes, that you know your control at design time. The easiest and most WPF-like (and to me the only correct) way, is to bind the "Text" property of the textcontrol to a string property (say: MyText) of an object (say: class MyData) used as the container's "DataContext". The "MyData" class must implement the interface "INotifyPropertyChanged" and the "MyText" setter must fire the "PropertyChanged" event. Now every change to the "MyText" property will be automatically be reflected in the textcontrol. Hope this helps to get you on the right track. Cheers Jürgen

    WPF csharp css wpf debugging question

  • Border as control
    J Jurgen Rohr

    Hi, you might want to consult the help about the VisualTreeHelper class. I think this provides the functionality you're looking for. If you need further assinstance, please provide some more concrete code/XAML. Cheers Jürgen

    WPF help tutorial

  • IsMouseOver not sensed (Triggers in a Control Template) ???
    J Jurgen Rohr

    Hi, you didn't set the Background property of the "Border" in your ControlTemplate thus leaving it "null". Hence there is nothing to 'sense' the mouseover. In fact, even if you move the mouse fats over the Button-content you get a reaction. So, either set it via TemplateBinding or at least set it to Transparent - anything but "null" will do. Cheers Jürgen

    WCF and WF question dotnet wpf com help

  • Purpose of Web Service Namespaces
    J Jurgen Rohr

    Hi, having wondered about this myself, I don't know, whether I can provide real illumination, but at least I can share my thougts about it. I'm sure, that the EndpointAddress is not really suitable for identifying the service. In any network such a service can be addressed in at least two or three ways: 1. http://mydomain.com/myservice.asmx 2. http://13.13.200.7/... and eventually 3. http:/mydomain.dyndns.org/... There is no reason, to interpret the addressed service in different ways. Furthermore there might be 'copies' of the service in load balancing environments. So, the ony way to identify the service correct is via the namespace - as you do in C# and other languages. The provided namespace does not free you from specifiying the location. In fact you can provide anything (maybe regarding some naming rules) as a namespace - even if it doesn't exist. Cheers Jürgen

    C# csharp asp-net visual-studio wcf com
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups