Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all 18858 articles
Browse latest View live

Balloon notification for users when new article posted on SharePoint

$
0
0

Good day,

I am running SharePoint 2013 and I would like to notify users when a new article is published to a SharePoint list. I have identified Notifyicon as a possibility to achieve this but wanted to find out how else I could do this. A few questions:

  • If I use WPF where will the app install to? The user machines? I have about 500 users.
  • Also, what would be the trigger to notify the workstations that a new article has been posted or would I just need to be checking frequently.

Many thanks in advance.


How to add Skype plugin into default embedded web browser in WPF application?

$
0
0

The problem statement is to add Skype or Skype for Business 2015 functionality in existing WPF application.

So I searched for the Skype developer API and found that Skype Web SDK (https://msdn.microsoft.com/en-us/skype/websdk/skypewebsdk) is suitable to meet my current requirements i.e. text chat, audio, video (and future requirements can be file sharing and desktop sharing). But the only requirement is to add the Skype plugin into <g class="gr_ gr_15 gr-alert gr_gramm gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="15" id="15">web</g> browser in case if we are using Skype Web SDK in <g class="gr_ gr_16 gr-alert gr_gramm gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="16" id="16">web</g> application.

My initial assumption was that I can embed Skype Web SDK in <g class="gr_ gr_13 gr-alert gr_gramm gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="13" id="13">HTML</g> page or Web App and then embed it into default embedded WPF web browser in my WPF application. But now my question is that how can we add that "plugin" to the embedded web browser in WPF application?

OR

Is there any other Skype API/SDK available to use it in desktop based C#.Net WPF application to meet my requirements?

HOW TO RUN LIVE STREAMING IN WPF

$
0
0

Hi,

I want to get streaming using this live channel and want to show streaming in WPF application using VLC ActiveX Plug-in and IE Web Plugin v1. VLC is visible on WPF but not showing streaming when i add this link to VLC.AddTarget Method. 
 
Here is Channel Link : rtsp://livestreaming2.itworkscdn.net/squranlive/squran_360p

Is there any other way to get this steaming work in my progam ???
Can anyone help me in this Plz ?
 
Thanks
Jaa Zaib


Jazaib Hussain

WPF / Powershell - Gridview - change row color

$
0
0

Is there a way to change the row color?

I have tried using data triggers but get errors.

I have tried something very similar to this:


<Style TargetType="DataGridRow"><Style.Triggers><DataTrigger Binding="{Binding Path=City_name}" Value="SomeCity"><Setter Property="Background" Value="{StaticResource SomeCityBackground}"/></DataTrigger></Style.Triggers></Style>
Thanks.



Busy indicator globally in views

$
0
0

I have ViewA and ViewB. When clicking a button in View A, both Views are loading together. I have separated  busy indicators in both Views. It is ugly.

My question is can we use just one global busy indicator for both Views? I don't want to combine two Views. By the way, MVVM pattern.

How to get __RequestVerificationToken Cookie without browser?

$
0
0

I have a Azure Cloud application using AntiforgeryFilters for preventing from CSRF. Now I have another C# WPF application from which I need to send a POST request to Azure App, but the problem is that every Post request has to be validate by AntiforgeryFilter and I need to know two things:

  1. __RequestVerificationToken
  2. __RequestVerificationToken Cookies

I figured out that I should send first time only simple GET Request and my Cloud App return to WPF App simple View containing __RequestVerificationToken . Now I do not know how can I figure out the problem with the __RequestVerificationToken cookies, because I am not using any browser.

Do I Have here any options how I can get the value of __RequestVerificationToken Cookies?

Thanks for all advice.

WPF: Hiding object causes brief flash before disappearing

$
0
0

I have a simple button style which has data trigger which binds to a bool property and if property is false it hides the button using simple fade out animation and vice-versa.

But for some unknown reason, for the first time when I perform some task which sets the bool value to false. It gives a brief flash before fading out. Upon setting it to true everything is as expected.

My style is

<Style x:Key="CustomButtonStyle" TargetType="{x:Type Button}" ><Style.Triggers><DataTrigger Binding="{Binding IsButtonVisible}" Value="true"><DataTrigger.EnterActions><BeginStoryboard><Storyboard Storyboard.TargetProperty="Opacity" ><DoubleAnimation Duration="0:0:0.2" To="1"/></Storyboard></BeginStoryboard></DataTrigger.EnterActions><DataTrigger.ExitActions><BeginStoryboard><Storyboard Storyboard.TargetProperty="Opacity" ><DoubleAnimation Duration="0:0:0.2" To="0"/></Storyboard></BeginStoryboard></DataTrigger.ExitActions></DataTrigger><Trigger Property="Opacity" Value="0"><Setter Property="Visibility" Value="Collapsed"></Setter></Trigger><Trigger Property="Opacity" Value="1" ><Setter Property="Visibility" Value="Visible"></Setter></Trigger></Style.Triggers><Style.Setters><Setter Property="Height" Value="93"/><Setter Property="Width" Value="93"/><Setter Property="Opacity" Value="0"/></Style.Setters></Style>

Pop up is not closed on clicking of User control button In WPF

$
0
0

Opening pop up on click of icon in user control

<Popup x:Name="pp1" Placement="Center" AllowsTransparency="False"

PlacementTarget="{Binding ElementName=grdCT}"

IsOpen="{Binding ElementName=btnAdd, Path=IsChecked, Mode=TwoWay}"

Closed="pp1_Closed" StaysOpen="false" PopupAnimation="Slide" ><local:FDataControl x:Name="controlFDataControl"Background="White" BorderThickness="2" Width="388"/>

</Popup>

In when pop up opens it have one user control which have button to close pop up i want to close this pop up by clicking on close button of that popuped User control. i tried with staysopen=false and Isopen=true Please suggest that will ne needfull



Web Browser control new Window issue and support for Tabs

$
0
0

Recently working with WPF's web browser and found out that there is know way to know if a new window will open.

If for a link there is a "Target" Attribute like below <a href="<link>"target="blank">Clear Here</a>

Then the browse control will open the link in new browser and not give any event or way to avoid that.

this will also happen if user tries open a new window through javascript

function openWin()   { win = window.open("<link>"); }

This can we achieved with windows form Web Browser control but even that is not full proof as it does not give you any way to know which link will be opened in new windows.

Is there some way to achieve this and also know which link is being opened.


Xbap applications do no longer scale correct on high dpi pc's after win10 anniversary update

$
0
0

After having updated with win10 anniversary update, we having scaling issues on the xbap applications we use.

The clients affected use 150% or 200% scaling in their display settings.

Not sure if this is .net framework issue or Internet explorer issue, but this is very much blocking these client pc's of using the applications now. Only workaround is currently using 100% scaling and using lower resolution, which is a pity of course.

Example: any website hosting an Xbap application, like http://weathernews.com/wpfglobal.xbap for example

How Write This On C#

$
0
0
<DataGridTemplateColumn.CellTemplate>
                                <DataTemplate >
                                    <StackPanel>
                                        <TextBox  
                                            BorderBrush="White"
                                            />                                       
                                    </StackPanel>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>

Not understand

$
0
0

<DataGridTemplateColumn Header="Pick a Date"><DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding myDate}" /></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn.CellEditingTemplate><DataTemplate><DatePicker SelectedDate="{Binding myDate}" /></DataTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn>

I find Example but I not understand what mean myDate??? in this context

When I try start this example I have Exeption when edit row.

link for this

http://stackoverflow.com/questions/18680083/how-to-add-a-datepicker-to-datagridtextcolumn-in-wpf


XAML binding to CompositeCollection

$
0
0

I have only one datagrid in a single view but the collections which are ItemsSource's of this datagrid are in different View Models. So is it possible to bind this single datagrid in view with the collections in two different View Models?

For each row in the grid, display an item from one collection, and an item from the other collection..! to display all columns in one row.

xaml:

DataContext="{DynamicResource ViewModelCombine}"><Window.Resources><vm:ViewModelCombine x:Key="ViewModelCombine"/></Window.Resources><Grid><Grid.RowDefinitions><RowDefinition Height="Auto"/></Grid.RowDefinitions><DataGrid><DataGrid.Resources><CollectionViewSource x:Key="ViewModelPulse" Source="{Binding VP}"/><CollectionViewSource x:Key="ViewModeltherapy" Source="{Binding VT}"/></DataGrid.Resources><DataGrid.ItemsSource><CompositeCollection><CollectionContainer Collection="{Binding Source={StaticResource ViewModelCombine}, Path=VP}" /><CollectionContainer Collection="{Binding Source={StaticResource ViewModelCombine}, Path=VT}" /></CompositeCollection></DataGrid.ItemsSource><DataGrid.Columns><DataGridTextColumn Header="AMP" Binding="{Binding AMP}" Width="100"/><DataGridTextColumn Header="PW" Binding="{Binding PW}" Width="100" /><DataGridTextColumn Header="DZ0" Binding="{Binding DZ0}" Width="100" /><DataGridTextColumn Header="DELTA" Binding="{Binding DELTA}" Width="100" /><DataGridTextColumn Header="DZ1" Binding="{Binding DZ1}"   Width="100"/><DataGridTextColumn Header="M" Binding="{Binding M}" Width="100" /><DataGridTextColumn Header="DZ2" Binding="{Binding DZ2}" Width="100" /><DataGridTextColumn Header="N" Binding="{Binding N}" Width="100" /></DataGrid.Columns></DataGrid></Grid> 

xaml.cs:

public MainWindow()
    {
        InitializeComponent();
        ViewModelCombine VMC = new ViewModelCombine();
        this.DataContext = VMC;
    } 

ViewModelCombine.cs

public class ViewModelCombine
{
    public ViewModelTherapy VT { get; set; }
    public ViewModelPulse VP { get; set; }

    public ViewModelCombine()
    {
        VT = new ViewModelTherapy();
        VP = new ViewModelPulse();
    }
 } 

As per the above code, it displays like above..but, wanted to display all columns in one row.

So is it possible to bind this single datagrid in view with the collections in two different View Models?

Thanks for your help.



Set WPF windows behave like WIN form when DPI changed

$
0
0

I have an application in mixed up by windows form and WPF. Main screen is developed by windows form and there are couples of screen developed using WPF. These WPF screens are launched from the main screen. After launched WPF screen, main screen become smaller and texts changed smaller. Reference to http://www.dotnetfunda.com/articles/show/882/wpf-tutorial-a-beginning-1 . WPF is independent to DPI setting. Is there anyway to set WPF depended on DPI setting like window form?

DataGrid.BeginEdit ()

$
0
0

DataGrid.BeginEdit ()

DataGrid.CommitEdit ()

DataGrid.CancelEdit

Please Help Me understand. Where I can use this metods?

How to create popup user control WPF datagrid

$
0
0
XML<Popup Margin="0,0,0,0" Name="Popup1" PopupAnimation="Slide"           PlacementTarget="{Binding ElementName=Dgv}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250" Height="150" />


       private void Dgv_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
        {
 	            Point newPosition = new Point();
                double rowX = 0;
                DataGrid dg = GetRowsDataGrid(e.Row);
                if (dg != null)
                {
                    rowX = GetColumnXPosition(e.Column, dg);
                    newPosition = e.Row.TranslatePoint(new Point(Dgv.RowHeaderWidth, e.Row.ActualHeight), this);
                }

                if (newPosition != new Point())
                {
                    Popup1.PlacementRectangle = new Rect(rowX + Dgv.RowHeaderActualWidth, newPosition.Y - Dgv.Margin.Top, 0, 0);
                }
                Popup1.IsOpen = true;
        }

        private double GetColumnXPosition(DataGridColumn column, DataGrid grid)
        {
            double result = 0.0;
            if (grid == null)
                return result;
            for (int i = 0; i < grid.Columns.Count; i++)
            {
                DataGridColumn dgc = grid.Columns[i];
                if (dgc.Equals(column))
                    break;
                result += dgc.ActualWidth;
            }
            return result;
        }

        private DataGrid GetRowsDataGrid(DataGridRow row)
        {
            DependencyObject result = VisualTreeHelper.GetParent(row);
            while (result != null && !(result is DataGrid))
            {
                result = VisualTreeHelper.GetParent(result);
            }
            return result as DataGrid;
        }
        private void Dgv_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            Popup1.IsOpen = false;
        }

I want to convert this to user controlusing below code
XAML

<DataGrid x:Class="WpfGrid.WGrid"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:WpfGrid"
             mc:Ignorable="d"
             d:DesignHeight="300" Width="500" PreviewKeyDown="DataGrid_PreviewKeyDown" BeginningEdit="DataGrid_BeginningEdit" SelectionMode="Single" SelectionUnit="Cell" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" CanUserResizeColumns="False" EnableRowVirtualization="False" PreviewTextInput="DataGrid_PreviewTextInput"><DataGrid.Resources ><Popup x:Key="GPopup" Margin="0,0,0,0" Name="XPopup" PopupAnimation="Slide"  PlacementTarget="{Binding ElementName=WGrid}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250" Height="150" /></DataGrid.Resources></DataGrid>

In code

          private void DataGrid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
        {
            Point newPosition = new Point();
                double rowX = 0;
                DataGrid dg = GetRowsDataGrid(e.Row);
                if (dg != null)
                {
                    rowX = GetColumnXPosition(e.Column, dg);
                    newPosition = e.Row.TranslatePoint(new Point(Dgv.RowHeaderWidth, e.Row.ActualHeight), this);
                }

                if (newPosition != new Point())
                {
                   **//Upto this it is ok  here I want to access the   <DataGrid.Resources > Gpopup and show it.**
                    Popup1.PlacementRectangle = new Rect(rowX + Dgv.RowHeaderActualWidth, newPosition.Y - Dgv.Margin.Top, 0, 0);
                }
                Popup1.IsOpen = true;


        }
I don't know I am right as I am new to Wpf so please help how to acheive this or is there any alternate to create user control
to popup window below a cell.

Thanks


programmer

Focus textbox after async call

$
0
0

Hi, I have a strange problem. After using an asynchronous call, I can not do focus to a particular control (textbox in this example). If I comment the lines where asynchronous calls, the focus works perfectly. i'm use MVVM Light 5.3.0 Why? Thx!

<TextBox Grid.Row="0"
                         Grid.Column="1"
                         utilidades:FocusExtension.IsFocused="{Binding IsFocused}"
                         Text="{Binding Articulo.Codigo, UpdateSourceTrigger=PropertyChanged}" />


        private async void CargarRubros()
        {
            PrepareIsBusy();

            ShowIsBusyMessage = true;

            ActiveProgressRing = true;

            IsBusyCustomMessage("Cargando rubros...");

            try
            {
                Rubros =
                    await
                        Task.Factory.StartNew(() => new ObservableCollection<Rubro>(_rubroService.TodosLosSubrubros()));

                ActiveProgressRing = false;

                if (Rubros.Any())
                {
                    RubroSeleccionado = Rubros.First();
                }
                else
                {
                    IsBusyInfoMessage("No se encontraron rubros.");

                    await Task.Factory.StartNew(() => Thread.Sleep(2000));
                }
            }
            catch (Exception)
            {
                IsBusyErrorMessage("Error al intentar obtener los rubros.");

                ActiveProgressRing = false;

                await Task.Factory.StartNew(() => Thread.Sleep(2000));
            }
            finally
            {
                ShowIsBusyMessage = false;

                ResetMessageAndImage();

                PrepareIsBusy();

                IsFocused = true;
            }
        }

    public static class FocusExtension
    {
        public static bool GetIsFocused(DependencyObject obj)
        {
            return (bool)obj.GetValue(IsFocusedProperty);
        }

        public static void SetIsFocused(DependencyObject obj, bool value)
        {
            obj.SetValue(IsFocusedProperty, value);
        }

        public static readonly DependencyProperty IsFocusedProperty =
            DependencyProperty.RegisterAttached(
                "IsFocused", typeof(bool), typeof(FocusExtension),
                new UIPropertyMetadata(false, null, OnCoerceValue));

        private static object OnCoerceValue(DependencyObject d, object baseValue)
        {
            if ((bool) baseValue)
            {
                ((UIElement) d).Focus();
            }
            else if (((UIElement) d).IsFocused)
            {
                Keyboard.ClearFocus();
            }
            return (bool)baseValue;
        }
    }
        private bool _isFocused;

        public bool IsFocused
        {
            get { return _isFocused; }
            set
            {
                _isFocused = value;
                RaisePropertyChanged("IsFocused");
            }
        }

NEW

I share a file with a sample project. I use NET4.0, 4.5 and 4.6.

With net4 I downloaded the extension "Microsoft.Bcl.Async" to use TaskEx.Run. Also had the same problem with "Task.Factory.StartNew".

https://mega.nz/#!71UXQLxJ!a87-8v1gDASRQRKOl4LlUGUwDSixrBUYipP2in8mPKA


WPF Polygon Class drawing a particular shape

$
0
0

how would I draw the following tags using the polygon class or whatever with WPF. I have managed to do the rectangular pointers  at the bottom of the graphic but would like to know how to do the circular pointers 1, 2, 3.  Any help gratefully received, thank you.

image location


 Polygon poly = new Polygon();
 poly.Points = new PointCollection();
 poly.Points.Add(new Point(8, 0));
 poly.Points.Add(new Point(18, 7));
 poly.Points.Add(new Point(8, 15));
                   

Wpf Performance hit when drawing million rectangle

$
0
0

I am drawing million rectangle on a control using DrawingContext.DrawRectangle.  The control width and height is 1000000 * 1000000. It is taking around 5 sec to 7 sec to  render on the screen. I have made the brush static and also have used Freeze. Can i reduce the time for rendering. Or there is any better approach for the same.

I have also used Bitmap for drawing which is very much faster. But bitmap has a limitation of size. it cannot be more than 12000*12000.

You can download the sample from here

Let me know if you want anything from my side.

Padding in WrapPanel

$
0
0
Hi,
 
How can I set top padding for WrapPanel? I need to move items in first row little bit down.

Thank you.
Viewing all 18858 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>