KushMishra 38 Senior Technical Lead

Just to mention that my docker-compose.yml looks like the following:

version: '3.4'

networks:
  myapp-network:
    driver: bridge

services:
  myapp:
    image: myapp:latest
    depends_on:
      - "postgres_image"
    build:
      context: .
      dockerfile: Dockerfile
    env_file: .env
    ports:
      - "5000:80"
    volumes:
      - myapp_logsvolume: /data/logs/app
    environment:
      ISDOCKER: ${ISDOCKER}
    networks:
      - myapp-network    

  postgres_image:
    image: postgres:latest
    ports:
      - "5432:5432"
    restart: always
    volumes:
      - postgres_datavolume:/var/lib/postgresql/data
      - postgres_backupvolume:/backups
    environment:
      POSTGRES_USER: ${POSTGRESUSER}
      POSTGRES_PASSWORD: ${POSTGRESPWD}
      POSTGRES_DB: ${POSTGRESDB}
    networks:
      - myapp-network

volumes:
  myapp_logsvolume:
  postgres_datavolume:
  postgres_backupvolume:
KushMishra 38 Senior Technical Lead

Hi All,

Any suggestions on how could we attach the NLog.config to a docker-compose.yml file so that it generates an “NLog_Internal.txt” on the host machine and we can see all the application logs in that file?
In other words, is there a way we could extract the logs of an application running inside a Docker container using NLog on a specified location (local disk or cloud)?

I have tried creating an ASP.NET Core application with the following NLog.config file:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true"
      throwConfigExceptions="true"
      internalLogLevel="Trace"
      internalLogToConsole="true">

  <variable name="dockerlogDirectory" value="/data/logs/app"/>

  <targets>
    <target xsi:type="File" name="ownFile" fileName="${dockerlogDirectory}/MyCustomLog-${shortdate}.log"
            layout="${longdate}|${logger}|${uppercase:${level}}|${threadid}:${threadname}|${message} ${exception}" />
    <target xsi:type="Console" name="console" />
    <target xsi:type="Null" name="blackhole" />
  </targets>

  <rules>
    <logger name="*" minlevel="Trace" writeTo="console" />
    <logger name="Microsoft.*" minlevel="Trace" writeTo="blackhole" final="true" />
    <logger name="*" minlevel="Info" writeTo="ownFile" />
  </rules>

</nlog>

Thanks.

KushMishra 38 Senior Technical Lead

I am not sure if we could use C# (like we use Python) as the programming language for Machine Learning and Data Science. It perhaps, gets limited into areas like these. Moreover, there are services available on the Cloud and also, as multiple platforms/tools that could help the naive user to do things without even programming.

KushMishra 38 Senior Technical Lead

You can use the Click Once publishing tools to publish the application as a single bundle (MSI-Microsoft Installer) and deploy this MSI on the server or onto the IIS server. Then using the URL of the server, one could access the application on multiple clients.

KushMishra 38 Senior Technical Lead

Thanks for no replies guys, I solved it myself.

For your information, I just had to specify the "Source" of the Binding which goes as follows:

    <Entry Grid.Column="1" Placeholder="Email" Margin="3" Text="{Binding LoginEmail, Mode=TwoWay}"
                   IsVisible="{Binding SelectedPhoneEmailIndex, Converter={StaticResource KMConvert}, ConverterParameter=EMAILVIS}">
       <Entry.Behaviors>
          <kmBehaviors:EmailValidatorBehavior IsValidEntry="{Binding IsValidValueEntered, Mode=TwoWay, Source={StaticResource kmViewModel}}"
          EmailErrorMessage="{Binding ErrorMessageForEmail, Mode=TwoWay, Source={StaticResource kmViewModel}}"/>
       </Entry.Behaviors>
    </Entry>

And, this did the job because earlier the Text was

KushMishra 38 Senior Technical Lead

Anyone please?

KushMishra 38 Senior Technical Lead

Hi,

I am an absolute beginner to Xamarin and just started to develop a small application wherein, I am not getting any idea about why the BindableProperty changes are not getting reflected inside the view model.
Presently, I have written my BindableProperty in a separate Class and the code is as follows:

public static readonly BindableProperty IsValidEntryProperty = BindableProperty.Create("IsValidEntry", typeof(bool), typeof(MaxLengthValidatorBehavior), false, BindingMode.TwoWay);

public bool IsValidEntry
{
   get { return (bool)GetValue(IsValidEntryProperty); }
   set { SetValue(IsValidEntryProperty, value); }
}

protected override void OnAttachedTo(Entry bindable)
    {
        bindable.TextChanged += HandleTextChanged;
        base.OnAttachedTo(bindable);
    }

void HandleTextChanged(object sender, TextChangedEventArgs e)
    {
        IsValidEntry = false;
        IsValidEntry = (Regex.IsMatch(e.NewTextValue, emailRegex, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250)));
        if (IsValidEntry)
            EmailErrorMessage = string.Empty;
        else
            EmailErrorMessage = "The email specified is incorrect";
        ((Entry)sender).TextColor = IsValidEntry ? Color.Default : Color.Red;
    }

And, the view's code is as follows:

<Entry Grid.Column="1" Placeholder="Email" Margin="3" Text="{Binding LoginEmail, Mode=TwoWay}"
               IsVisible="{Binding SelectedPhoneEmailIndex, Converter={StaticResource KMConvert}, ConverterParameter=EMAILVIS}">
   <Entry.Behaviors>
      <kmBehaviors:EmailValidatorBehavior IsValidEntry="{Binding IsValidValueEntered, Mode=TwoWay}"
                                          EmailErrorMessage="{Binding ErrorMessageForEmail, Mode=TwoWay}" />
   </Entry.Behaviors>
</Entry>

Here, the "IsValidValueEntered" property (which is, of course, present in the view model) is bound to another Label's Text property in the same view but somehow, whenever any changes are done to the "IsValidEntryProperty" BindableProperty, those changes do not hit the setter of "IsValidValueEntered" property in the view model.

Any help is appreciated.

Thanks very much indeed.

KushMishra 38 Senior Technical Lead

Any help please, anyone?

KushMishra 38 Senior Technical Lead

Hi Shark_1, any other way to do this please?

I do not want to implement this approach because on the parent control, I have already handled DragEnter, MouseMove etc. events and do not want to override the handlers (probably if there is any way to inherit the events and then write my own logic like we do "BasedOn" for styles?).

Would appreciate any help, thanks.

KushMishra 38 Senior Technical Lead

Are you using ASP.NET Core?

KushMishra 38 Senior Technical Lead

You could probably design an intermediate service which would have some events regsitered to notify whether any changes to the database were made or not.
Is that what you're looking for?

KushMishra 38 Senior Technical Lead

Not sure, but just wanted to know whether you've got any other alternatives other than caching the content because as far as I know, it would not be wise to cache the whole website.
Also, I think if anyone is browsing your website the very first time, then they shouldn't experience the caching problem.

Of course some code snippet would be of great help to dig in what's happening and how could we control the same.

Thanks.

KushMishra 38 Senior Technical Lead

Hi,

I am developing my own designer and got stuck at a point where I need to establish or implement some business logic whenever any UI Element is dragged and determine if that falls withing the boundaries of another parent control (specifically TabControl or GroupBox), so that the next time we drag the parent, the child moves with it (and of course, in case of TabControl, the child becomes part of the selected TabItem only and the other TabItems would still be shown with empty content). I also want to implement the reverse behaviour, that is, whenever a child is dragged outside the boundaries of a parent control and kept anywhere on the screen.

I tried VisualTreeHelper.HitTest() but that didn't work out (may be I used that incorrectly, not sure).

Any help would really be appreciated.

Thanks very much.

KushMishra 38 Senior Technical Lead

Anyone please ?

KushMishra 38 Senior Technical Lead

Here's my code that did not work out for me (the buttons are getting animated but not together).

<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Button x:Name="btnFirst" Content="First Button">
            <Button.Style>
                <Style>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsFirstChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:1" AutoReverse="True" RepeatBehavior="Forever" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard FillBehavior="Stop">
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.ExitActions>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Button.Style>            
        </Button>
        <CheckBox x:Name="chkFirst" Content="Check First" IsChecked="{Binding IsFirstChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

        <Button x:Name="btnSecond" Content="Second Button">
            <Button.Style>
                <Style>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsSecondChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:1" AutoReverse="True" RepeatBehavior="Forever" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard FillBehavior="Stop">
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.ExitActions>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Button.Style>
        </Button>
        <CheckBox x:Name="chkSecond" Content="Check Second" IsChecked="{Binding IsSecondChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
    </StackPanel>
KushMishra 38 Senior Technical Lead

Hi,

rproffitt, Surely I will (If you have anything, you could share) :)

ddanbe, Actually I am using MVVM and also, I want to apply blinking animation (like trigger) at the same time to multiple conditions. Here's the present scenario I have:

I have 2 properties bound to 2 separate controls, say 2 checkboxes. Now, if one of the checkbox is checked then, it would check if my button's content value is greater than 0 and if yes, then the buttoon should start blinking. Now, the problem is suppose one of the button is already blinking, then upon checking the other checkbox, if the second button has also got some value greater than 0, then the second button should also start blinking but in sync with the first button.

Perhaps, the start storyboard or pause storyboard could help or if possible, could we use some triggers and control the animation effect?

Thanks very much indeed.

KushMishra 38 Senior Technical Lead

Hi All,

Could anyone please suggest on how to apply multiple styles to multiple elements at runtime and that too the styles should be applied at the same time on all elements.
For instance, I want to animate two buttons but their styles are different. Now if I apply the style to both, the style which is applied first at runtime by the compiler would be invoked and so, I will not have the blinking effect at the same time for these 2 buttons.

Any suggestions please?
Thanks.

rproffitt commented: I see you reposted. I'm interested to see if you crack this nut. +12
KushMishra 38 Senior Technical Lead

Hi tinstaafl, ddanbe and xrj,

Thank you very much all for your suggestions.

xrj, this didn't work for me because as tinstaafl said, I mentioned earlier that my collection contains more than one record for each ID, so the following would throw exception of having a pre-existing key.

Dim q = (From p In A1 Select ID = p.ID,
                    value = p.Name + "|" + p.Address + "|" + p.email + "|" + p.phone + "|" + p.city).ToDictionary(
                    Function(x) x.ID, Function(x) x.value)

ddanbe and xrj, I understand that you tried to help me and really appreciate that. Thanks again.

tinstaafl, you simply rock and thanks very much indeed for your help on this as this is exactly I have been looking for. Cheers :)

KushMishra 38 Senior Technical Lead

Hi All,

I have a collection of huge records (6000+) wherein the object in the collections has got 50+ properties, so ideally it is not a good idea to run a "For-Each" loop here.
What I want is a "GroupBy" clause which would get me a Dictionary (Of String, String) from this collection where the key is the primary key (A) of this object and the value would be concatenation of another property (B) with "|" seperated values for each key (A).

For example:

Dim collectionA As A() = DAL.searchForComments

Here, "A" has got 50 properties (ID, Name, Address etc.) and "collectionA" has got multiple entries for "ID". What I want is to build a Dictionary (Of ID, Name) where all the "Name" values would be "|" seperated for each ID.

Any help would be appreciated.

Thanks very much.

KushMishra 38 Senior Technical Lead

Hi, you may go through the following link. Hope this helps.

Click Here

KushMishra 38 Senior Technical Lead

Hi david_105, just a thought if you could possibly have the value concatenated by some means (if possible) and bind the string values inside 2 properties and when you want to hide the value, probably, store the ID in some temporary field, assign the ID string property to null/empty and of course retain that later if you want to. Not sure though about the implementation but this is just a logic that I can suggest for now if this possible in the launguage you're using.

KushMishra 38 Senior Technical Lead

Hi xrj, I know that using the x:key would surely solve this problem but this would not be a generic solution as I would need to apply this key to every window's style which I don't want to.

Hi rproffitt, probably you're new to WPF (first of all consider reading and rather implementing other books too) as this is a basic thing about applying styles to the controls (that includes Window itself too). Let me tell you a basic thing. All the elements are derived from "FrameworkElement" class whether it is a Window or any control because Window is itself a control. Also, to your first reply, I already mentioned that I want to make this approach generic and by using keys, I would need to manually apply that style in all the windows which is NOT a general approach (I am clearly usiung only "x:Type") (Please read first before posting, as I already saw your replies to my previous post).
Also, rproffitt, do not consider this as a rude response because this is exactly like what you've posted inside my previous article (I believe just to earn reputation points or increase your posting score).

rproffitt commented: Points can go either way. Chill. +12
KushMishra 38 Senior Technical Lead

Hi, you can try third-party software like "lockmaster" or "Take Ownership" to unlock the files being used or take the ownership of the files in order to modify/delete them. I suppose that in your case, "Take Ownership" should help you.

KushMishra 38 Senior Technical Lead

Hi, you can repair the Windows by using the USB media or inserting a Windows installation disk. Also, was the installation really completed because I doubt it would ask for the Windows files if the Windows was fully installed at the first place.

KushMishra 38 Senior Technical Lead

Hi, are you struggling for an example to this problem or are you stuck at some point which you need help with?

KushMishra 38 Senior Technical Lead

Hi, is this a laptop and have you tried starting that with another battery? Also, you can try inserting the windows DVD and see if that works, but yes, it would be helpful if you could tell us the exact make-model of the computer.

KushMishra 38 Senior Technical Lead

Hi,

Have you tried booting this on Safe Mode. Just click shut down by pressing the "Shift" key on the keyboard and then go top troubleshoot. The safe mode might allow you to access this (not sure, but you can try at least).

KushMishra 38 Senior Technical Lead

Hi Everyone,

I started creating a new WPF project wherein, I have just added a style to all the elements of type "Window" and "Grid" but none of these are working (rather a wierd black box is apprearing - Screenshot attached).
NOTE: I do not want to use "x:Key" for the styles as I want these styles to be automatically applied to all the windows which I would add further.

Here is the code below:

Window XAML:
<Window x:Class="General_WPF.Views.StartPage_View"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:General_WPF.Views"
        xmlns:viewModel="clr-namespace:General_WPF.ViewModels"
        mc:Ignorable="d" Title="Welcome User">
    <Window.DataContext>
        <viewModel:StartPage_VM />
    </Window.DataContext>

    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Text="Hello" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
        <TextBox Grid.Row="1" Height="25" Width="100" HorizontalAlignment="Center" VerticalAlignment="Center" />
    </Grid>
</Window>
Style:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:General_WPF.ResourceDictionaries">

    <Style TargetType="{x:Type Window}">
        <Setter Property="Height" Value="500" />
        <Setter Property="Width" Value="500" />
        <Setter Property="Background" Value="Red" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="AllowsTransparency" Value="True"/>
    </Style>

    <Style TargetType="{x:Type Grid}">
        <Setter Property="Height" Value="250" />
        <Setter Property="Width" Value="250" />
        <Setter Property="Background" Value="LightSalmon" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>  

</ResourceDictionary>
App.xaml:
<Application x:Class="General_WPF.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:General_WPF"
             StartupUri="Views/StartPage_View.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ResourceDictionaries\MyStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
KushMishra 38 Senior Technical Lead

Thanks ddanbe for the help and suggestions on reading the book, its really useful.

For rubberman and rproffitt, I would just say that these might seem to you as basic questions and I agree that I have been doing this since 7 years on Daniweb but instead of seeing your unnecessary "explaination" on this post, I expected at least some sensible answers because I thought to create a thread to have some of the basics under one umbrella, but thanks anyways for posting.

KushMishra 38 Senior Technical Lead

Hi All,

I would appreciate if someone could please answer to the following queries.

  1. Difference between "new" and "new virtual" when deriving classes from other classes.
  2. Difference between Abstarction and Encapsulation (with example, if possible).
  3. Types of constructors and their implementations (when and how to use).
  4. Different types of locking mechanisms and/or deadlock prevention ways and when to use what.
  5. Different types of design patterns, when to use what and their usage (with example, if possible).
  6. Difference between async and await and when to use them (with example, if possisble).
  7. What other topics do you suggest to prepare for .NET, C#, OOP, WPF and SQL?

I know these are multiple topics under a single thread but you may please answer to the ones which you think would be beneficial.

Thanks everyone.

KushMishra 38 Senior Technical Lead

Hi,

Anyone please ?

KushMishra 38 Senior Technical Lead

Hi,

I have a WPF Grid with multiple controls like TextBox, ComboBox, CheckBox etc. and their properties like Text, SelectedItem, IsChecked etc. are present inside the view model bound to the view perfectly.
I want to copy the values of all the controls to the Clipboard (may be) and want to paste the corresponding values of these controls again and similarly, I want to clear all the values on clear button click.

I would appreciate if anyone could please suggest a possible way of achieving this functionality.
Thank you very much for your help and time.

KushMishra 38 Senior Technical Lead

Anyone please ?

KushMishra 38 Senior Technical Lead

I think may be no one could figure this out, anyways I got my own solution now by passing the whole UIElement as the parameter :)

KushMishra 38 Senior Technical Lead

I think may be no one could figure this out, anyways I got my own solution now using third party controls :)

KushMishra 38 Senior Technical Lead

Hi All,

Just wanted to know on how to dynamically set the focus on a TabItem of a TabControl in WPF at runtime using bindings etc.

Thanks

KushMishra 38 Senior Technical Lead

Hello All,

I am developing an application in WPF in which I need to set a generic input bindings for TAB key for every field present in the view. I somehow managed to create a common method but now I wnat to retrieve on which field the TAB key has been hit.

So, I want to know how can I pass a generic framework element or anything to the command parameter so that I can retrieve on which field the vent is taking place.

My xaml code is as follows :-

<Window.InputBindings>
     <KeyBinding Key="Tab" Command="{Binding TabCommand}" CommandParameter="{Binding .}" />
</Window.InputBindings>

Right now, using the above xaml code I am getting the whole window as the parameter but it can't show on which element the TAB has beet hit. Please help me if anyone knows how to get this solved.

Thanks a lot in advance.

KushMishra 38 Senior Technical Lead

You may go through this link :-
Click Here

KushMishra 38 Senior Technical Lead

Hi Sharron,

I am a bit confused and unable to integrate your solution into my "WebBrowserUtility" code...Appreciate a lot for your help however, I am a newbie to this one and it would be great if could possibly help me with the same.

Thanks a lot again :)

KushMishra 38 Senior Technical Lead

Thanks a lot Sharron for this one...I'll try to implement the solution and will let u know about the same...Thanks again :)

KushMishra 38 Senior Technical Lead

Hi All,

I am facing some issues when writing a xaml and my code goes as follows :-

 <Grid>
        <Grid.Resources>
            <!-- Shared Storyboard across the system -->
            <!-- This storyboard will make the image (button) grow to double its size in 0.2 seconds -->
            <Storyboard x:Key="expandStoryboard">
                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="2.5" Duration="0:0:0.2" />
                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="2.5" Duration="0:0:0.2" />
                <Int32Animation Storyboard.TargetName="myImage" Duration="00:00:0.2" Storyboard.TargetProperty="(Panel.ZIndex)" From="998" To="999"/>
            </Storyboard>
            <!-- This storyboard will make the image revert to its original size -->
            <Storyboard x:Key="shrinkStoryboard">
                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="0:0:0.2" />
                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="0:0:0.2" />
            </Storyboard>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Button Grid.Column="0" Height="50" Width="50" Panel.ZIndex="999">
            <Image x:Name="myImage" RenderTransformOrigin="0.5,0.5" Source="/Kush_StoryboardAndTriggers;component/Images/New.png">
                <Image.Triggers>
                    <EventTrigger RoutedEvent="Image.MouseEnter">
                        <EventTrigger.Actions>
                            <BeginStoryboard Storyboard="{StaticResource expandStoryboard}" />
                        </EventTrigger.Actions>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="Image.MouseLeave">
                        <BeginStoryboard Storyboard="{StaticResource shrinkStoryboard}" />
                    </EventTrigger>
                </Image.Triggers>
                <Image.RenderTransform>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                </Image.RenderTransform>
            </Image>
        </Button>
        <Button Grid.Column="1" Height="50" Width="50" Panel.ZIndex="999">
            <Image RenderTransformOrigin="0.5,0.5" Source="/Kush_StoryboardAndTriggers;component/Images/open.jpg">
                <Image.Triggers>
                    <EventTrigger RoutedEvent="Image.MouseEnter">
                        <EventTrigger.Actions>
                            <BeginStoryboard Storyboard="{StaticResource expandStoryboard}" />
                        </EventTrigger.Actions>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="Image.MouseLeave">
                        <BeginStoryboard Storyboard="{StaticResource shrinkStoryboard}" />
                    </EventTrigger>
                </Image.Triggers>
                <Image.RenderTransform>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                </Image.RenderTransform>
            </Image>
        </Button>
        <Button Grid.Column="2" Height="50" Width="50" Panel.ZIndex="999">
            <Image RenderTransformOrigin="0.5,0.5" Source="/Kush_StoryboardAndTriggers;component/Images/Diary.png">
                <Image.Triggers>
                    <EventTrigger RoutedEvent="Image.MouseEnter">
                        <EventTrigger.Actions>
                            <BeginStoryboard Storyboard="{StaticResource expandStoryboard}" />
                        </EventTrigger.Actions>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="Image.MouseLeave">
                        <BeginStoryboard Storyboard="{StaticResource shrinkStoryboard}" />
                    </EventTrigger>
                </Image.Triggers>
                <Image.RenderTransform>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                </Image.RenderTransform>
            </Image>
        </Button>
        <Button Grid.Column="3" Height="50" Width="50" Panel.ZIndex="999">
            <Image RenderTransformOrigin="0.5,0.5" Source="/Kush_StoryboardAndTriggers;component/Images/workstation.gif">
                <Image.Triggers>
                    <EventTrigger RoutedEvent="Image.MouseEnter">
                        <EventTrigger.Actions>
                            <BeginStoryboard Storyboard="{StaticResource expandStoryboard}" />
                        </EventTrigger.Actions>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="Image.MouseLeave">
                        <BeginStoryboard Storyboard="{StaticResource shrinkStoryboard}" />
                    </EventTrigger>
                </Image.Triggers>
                <Image.RenderTransform>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                </Image.RenderTransform>
            </Image>
        </Button>
        <Button Grid.Column="4" Height="50" Width="50" Panel.ZIndex="999">
            <Image RenderTransformOrigin="0.5,0.5" Source="/Kush_StoryboardAndTriggers;component/Images/Settings.png">
                <Image.Triggers>
                    <EventTrigger RoutedEvent="Image.MouseEnter"> …
KushMishra 38 Senior Technical Lead

Hello All,

I am just a newbie trying to explore areas into game developement using .Net (may be XNA studio) though I am not familier with the same.
Could you please suggest some tutorials, ebooks for this so that I can start as a beginner and then later on, may be I can proceed to an advanced level of expertise or any other advice that what tool I really need to use for this ?

Thanks to all in advance :)

KushMishra 38 Senior Technical Lead

One Statement from the movie "Lord Of The Rings" (One of my favourites too)...
"If there is something good in this world, then its worth fighting for...!!!"

KushMishra 38 Senior Technical Lead

Hey, I achieved this one by creating an observable collection of a class and this class holds on to 20 properties which I'm presently setting up in the VM.
Its working perfectly fine now....Thanks anyways for your suggestions and help :)

KushMishra 38 Senior Technical Lead

Any help guys ?

KushMishra 38 Senior Technical Lead

There are many ways to achieve this one :-

  1. As you write a function, you can select it and right click->Go to Definition (or hit F12).

  2. If you want the generic methods definition you may refer to the above suggestions.

By the way, nice name ;)

KushMishra 38 Senior Technical Lead

Hey, I did this one by creating a class and 2 properties in the same...Thanks anyways :)

KushMishra 38 Senior Technical Lead

Hi All,

I have got one scenario here in which I need to bind a DataGrid to a collection (array, ObservableCollection etc.).
My Collection name is "WarningList" and the code is as follows :-

ViewModel :-

WarningList = {({result.WarningMsgCode, result.WarningColor})}

xaml :-

<data:DataGrid x:Name="gridSystemWarnings" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Grid.RowSpan="2" DataContext="{Binding}" 
                                       IsReadOnly="True" CanUserSortColumns="True" ItemsSource="{Binding WarningList[0][0]}" AutoGenerateColumns="False" Margin="1" 
                                       ScrollViewer.CanContentScroll="True" Height="50" ScrollViewer.VerticalScrollBarVisibility="Auto" 
                                       ScrollViewer.HorizontalScrollBarVisibility="Auto" IsSynchronizedWithCurrentItem="True" HeadersVisibility="None">

                            <data:DataGrid.Columns>
                                <DataGridTextColumn Width="*" Binding="{Binding ., Converter={ssv:DataDecode SYSTEMMSG}, Mode=OneWay}">
                                    <DataGridTextColumn.CellStyle>
                                        <Style TargetType="DataGridCell">
                                            <Setter Property="Background" Value="{Binding Converter={ssv:ColourTranslate {Binding WarningList[0][1]}}}" />
                                        </Style>
                                    </DataGridTextColumn.CellStyle>
                                </DataGridTextColumn>
                            </data:DataGrid.Columns>

                        </data:DataGrid>

The "result.WarningMsgCode" is of type String() array while the "result.WarningColor" is of type Integer() array.
For now, I am getting the message code value but not getting the background color of each cell and also I'm not sure about the code

<Setter Property="Background" Value="{Binding Converter={ssv:ColourTranslate {Binding WarningList[0][1]}}}" />

Please help me as early as possible.

KushMishra 38 Senior Technical Lead

Hello All,

I have one webbrowser control and I took a dependency source property from the Internet and binded the same to my string Url.
I took this dependency property because .Net doesn't lets you bind the Source property to a string datatype and only Uri datatype.
Now I am getting the first page as google.com (set as static for now), but as I change something in the Url textbox, I want to know why this property doesn't updates in the dependency property class also.
My code is as follows :-

Dependency Property Class :-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace KMBrowser.KM_GenericClasses
{
    public static class WebBrowserUtility
    {
        public static readonly DependencyProperty BindableSourceProperty = DependencyProperty.RegisterAttached("BindableSource", typeof(string), typeof(WebBrowserUtility), new UIPropertyMetadata(null, OnBindableSourceChanged));

        public static string GetBindableSource(DependencyObject obj)
        {
            return (string)obj.GetValue(BindableSourceProperty);
        }

        public static void SetBindableSource(DependencyObject obj, string value)
        {
            obj.SetValue(BindableSourceProperty, value);
        }

        private static void OnBindableSourceChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            var browser = o as WebBrowser;
            if (browser == null)
                return;

            var uri = (string)e.NewValue;

            try
            {
                browser.Source = !string.IsNullOrEmpty(uri) ? new Uri(uri) : null;
            }
            catch (ObjectDisposedException) { }
        }
    }
}

xaml :-

<WebBrowser x:Name="MyWebBrowser" Grid.Row="1" Generics:WebBrowserUtility.BindableSource="{Binding Path=PageSource, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

Property in ViewModel :-

public string PageSource
        {
            get { return _pageSource; }
            set
            {
                _pageSource = value;
                OnPropertyChanged("PageSource");
            }
        }

Please help, if possible. Thanks a lot in advance :)

KushMishra 38 Senior Technical Lead

Its completely fine and thanks for your help for the same...I'll wait for your response on this one :)