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

WPF: How to make tabitem header text show in center of tab header control and whole Header is clickable?

$
0
0

Our application is WPF. One page includes tab control which include three tabs (TabItems).

Our industry designer wants to the three tabs evenly use the whole page width.

So we define the style " TabItemControlStyle2" which targets on TabItem.

<TabItem Header="tab1" Style="{StaticResource TabItemControlStyle2}"><Style x:Key="TabItemControlStyle2"  TargetType="{x:Type TabItem}"><Setter Property="FontSize" Value="20"/><Setter Property="Height" Value="45"/><Setter Property="Width" Value="298"/><Setter Property="BorderBrush" Value="{x:Null}"/><Setter Property="Background" Value="Pink"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type TabItem}"><Grid x:Name="gridTabItem"><Border x:Name="Border" Margin="0,0,0,0"
			   BorderBrush="{x:Null}" CornerRadius="7,7,0,0" BorderThickness="0" ><ContentPresenter x:Name="ContentSite" VerticalAlignment="Center"
					HorizontalAlignment="Center"
					ContentSource="Header" Margin="10,2,10,2"
					RecognizesAccessKey="True"></ContentPresenter></Border><Rectangle x:Name="rectangle" HorizontalAlignment="Left" Height="4" Margin="0,41, 0,0" Stroke="{x:Null}" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=gridTabItem}" StrokeThickness="0" d:CopyToken="64b87611-7ebf-482c-b9f1-e10935bd6b33" Fill="{x:Null}"/><Rectangle x:Name="rectangle1" HorizontalAlignment="Left" Height="1" Margin="0,43,0,0" Stroke="{x:Null}" StrokeThickness="0" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=gridTabItem}" Fill="#FFEEEEEE"/><Rectangle x:Name="glow" HorizontalAlignment="Left" Height="41" Margin="0" Stroke="{x:Null}" StrokeThickness="0" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=gridTabItem}" Fill="{x:Null}"/></Grid><ControlTemplate.Triggers><Trigger Property="IsSelected" Value="True"><Setter Property="Panel.ZIndex" Value="100" /><Setter TargetName="Border" Property="Background" Value="{StaticResource ButtonSelecteddBackgroundFill}"/><Setter TargetName="Border" Property="BorderThickness" Value="0" /><Setter Property="Foreground" Value="White" /><Setter Property="Fill" TargetName="rectangle"><Setter.Value><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="White" Offset="0.112"/><GradientStop Color="#FFE0E0E0" Offset="0.155"/><GradientStop Color="Gainsboro" Offset="0.866"/><GradientStop Color="#FF767676" Offset="0.957"/></LinearGradientBrush></Setter.Value></Setter><Setter Property="Fill" TargetName="rectangle1" Value="{x:Null}"/><Setter Property="Fill" TargetName="glow"><Setter.Value><RadialGradientBrush Center="0.5,1.001" GradientOrigin="0.5,1.001" RadiusY="0.618" RadiusX="0.618"><GradientStop Color="Transparent" Offset="1"/><GradientStop Color="#4CFFFFFF" Offset="0"/></RadialGradientBrush></Setter.Value></Setter></Trigger><Trigger Property="IsEnabled" Value="False"><Setter TargetName="Border" Property="Background" Value="DarkRed" /><Setter TargetName="Border" Property="BorderBrush" Value="Black" /><Setter Property="Foreground" Value="DarkGray" /></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter><Setter Property="BorderBrush" Value="{x:Null}"/><Setter Property="Background" Value="{x:Null}"/></Style>

So three Tab Headers are pretty wide. We notice that the button click targets on the tabs were only on the actual text of the buttons.  Clickong on other area except header text nothing happens.

if we add Width and Height in ContentPresenter section, the whole tab header control works like button.

However, the header text is not center of tab header anymore. Header text is on the top left corner

Even though we set the HorizontalAlignment and VerticalAlignment "Center". 

<ContentPresenter x:Name="ContentSite"
        VerticalAlignment="Center"  Width="298" Height="45"	HorizontalAlignment="Center"
	ContentSource="Header" Margin="10,2,10,2"
	RecognizesAccessKey="True"></ContentPresenter>
How can we ensure whole Tab header is like button and still keep the tab Header text in center of the Header area? Thx!


JaneC



Filter Combobox on text input.

$
0
0

Hi everyone,

I want to implement something like a google search text box with auto fill.

So I thought I will tweat the combo box (as it has almost everything I need), rather than implement the whole auto fill textbox by myself.

So I did this in xaml:

<ComboBox PreviewKeyDown="SearchTextBox_OnPreviewKeyDown"
							Text="{Binding SearchText}" x:Name="SearchTextBox"  ItemsSource="{Binding SearchResultList}" DisplayMemberPath="SerialNumber" Style="{DynamicResource ComboTextBoxStyle}"/>

In code behind:

private void SearchTextBox_OnPreviewKeyDown(object sender, KeyEventArgs e)
        {
            (sender as ComboBox).IsDropDownOpen = true;
        }

and in view model:

 private string _searchText;

        public string SearchText
        {
            get { return _searchText; }
            set
            {
                _searchText = value;
                filterList();
            }
        }

        private void filterList()
        {
            SearchResultList = MyList.Where(probe => probe.SerialNumber.ToString().StartsWith(_searchText)).ToList();
        }

Idea is that when user enters first key for example "a" then the view model will filter the list in the background, get all the items starting with "a" and that is bound to the combo box.

But the dropdown popup is empty (even though I can see few items in the SearchResultList in the view model).

Can someone tell me what I am doing wrong!


Please Mark as Answered If this answers your question OrUnMark as Answered if it did not.
Happy to Help :)
My Site

CancelAsync() of BackgroundWorker throwing exception in WPF Window

$
0
0

Hi,

I am converting a window that was in Winform to WPF. While doing i am facing the issue with background worker. The same code is working fine in Winforms, please let me know if i am missing something while converting the window to WPF.

When i click on Cancel button of the WPF window i have to stop the background worker and close this window. Sometime the window is closed immediately and some time it takes long time to close, but in case of Winform the window gets closed always. I have the below code,

public partial class ProcessingWPFWindow : Window
    {
       
        BackgroundWorker backgroundWorker1 = null ;
        System.Windows.Forms.ProgressBar progressBar1 =  null;
      
        public ProcessingWPFWindow ()
        {
           
            backgroundWorker1 = new BackgroundWorker();
            progressBar1 =  new System.Windows.Forms.ProgressBar();
            backgroundWorker1.WorkerReportsProgress = true;
            backgroundWorker1.WorkerSupportsCancellation = true;
            backgroundWorker1.DoWork += backgroundWorker1_DoWork;
            backgroundWorker1.ProgressChanged += backgroundWorker1_ProgressChanged;
            backgroundWorker1.RunWorkerCompleted += backgroundWorker1_RunWorkerCompleted;
            progressBar1.Maximum = 100;
            progressBar1.Minimum = 0;
            progressBar1.Step = 10;
        }

  private void ProcessingWPFWindow_Load(object sender, EventArgs e)
        {
     // I am setting the workerParams here and passing it in below line
            this.backgroundWorker1.RunWorkerAsync(workerParams);
        }

 private void CancelButton_Click(object sender, EventArgs e)
        {
            MyLabel.Content = "Cancelling request ... ";
            this.backgroundWorker1.CancelAsync();
        }

  private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
           
  BackgroundWorker bw = sender as BackgroundWorker;
  // I am doing some 3-4 processing here, after every processing i am calling the below snippet.
   // If the operation was canceled by the user,
                // set the DoWorkEventArgs.Cancel property to true.
               if (bw.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }

 }

  private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                // The user canceled the operation so just exit.
                this.DialogResult = false;
                this.Close();

                return;
            }

            if (e.Error != null)
            {
                // There was an error during the operation.
                string msg = String.Format("An error occurred: {0}", e.Error.Message);
                //MessageBox.Show(msg);
                MyMessageBox.Show(msg, Constants.msgBoxTitle, "FindingCitesBackgroundWorker");
                this.DialogResult = false;
                this.Close();
                //GC.Collect();
                return;
            }

  // The operation completed normally.
             this.DialogResult = true;
  //I am performing some operation and closing the window
  
  this.Close();
 }
}

Please let me know if i any changes . On clicking of Cancel button sometime the window is closed immediately and some time it takes long time to close. Thanks in advance.

Regards,


Chetan Rajakumar

BindingListCollectionView vs CollectionviewSource filtering

$
0
0

hi all,am coming from windows forms

as Microsoft mentioned BindingSource replacement is CollectionViewSource 

but i have questions.. 

am working with vb.net visual studio 2013 and Sql express2014 (no entity framework) for LOB applications

is it a good practice to work with no entity framework in wpf desktop applications?

can someone explain me what is the main difference between the BindingListCollectionViewvs CollectionViewSource?

where is appropriate to use one over the other

if i want to use filtering what is best to use?

i found that BindingListCollectionView CanFilterproperty is alwaysfalse

i know that in BindingListCollectionView i can have CustomFilter  and i can filter with the traditional way

e.g
somecolumn='sometext'

but how can i use the filter either in BindingListCollectionView or CollectionViewSource  with no entity framework ? is it possible ?

any sample code for filtering example in vb.net would be much appreciated.(no entity framework)


stelios ----------



DataGrid row virtualization display issue

$
0
0

Hello All,

I am facing issue while row visualization. i have a datagrid and i am creating multiple datagridcheckboxcolumn from code behind, and manually checking the checkboxes from foreach loop on some condition, but when i have only 60 - 80 records it is working fine but after that in last rows checkboxes are checked correctly but on top they get blank again. can any body solve my issue?

i am using this code for virtualization.

<DataGrid Margin="0,55,0,0" AutoGenerateColumns="False" CanUserAddRows="False" HorizontalAlignment="Left"
             EnableRowVirtualization="True"
             EnableColumnVirtualization="True"
             VirtualizingStackPanel.IsVirtualizing="True"
             VirtualizingStackPanel.VirtualizationMode="Standard">
and to get the cell from the datagrid i am using helper class which i found from msdn forum it is like - 
private  T GetVisualChild<T>(Visual parent) where T : Visual
        {
            T child = default(T);
            int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
            for (int i = 0; i < numVisuals; i++)
            {
                Visual v = (Visual)VisualTreeHelper.GetChild(parent, i);
                child = v as T;
                if (child == null)
                {
                    child = GetVisualChild<T>(v);
                }
                if (child != null)
                {
                    break;
                }
            }
            return child;
        }


        public  DataGridRow GetSelectedRow(DataGrid grid)
        {
            return (DataGridRow)grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem);
        }


        public  DataGridRow GetRow(DataGrid grid, int index)
        {
            DataGridRow row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index);
            if (row == null)
            {
                // May be virtualized, bring into view and try again.
                grid.UpdateLayout();
                grid.ScrollIntoView(grid.Items[index]);
                row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index);
            }
            return row;
        }


        public  DataGridCell GetCell(DataGrid grid, DataGridRow row, int column)
        {
            if (row != null)
            {
                DataGridCellsPresenter presenter = GetVisualChild<DataGridCellsPresenter>(row);

                if (presenter == null)
                {
                    grid.ScrollIntoView(row, grid.Columns[column]);
                    presenter = GetVisualChild<DataGridCellsPresenter>(row);
                }

                DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
                return cell;
            }
            return null;
        }

        public  DataGridCell GetCell(DataGrid grid, int row, int column)
        {
            DataGridRow rowContainer = GetRow(grid,row);
            return GetCell(grid,rowContainer, column);
        }
       
please any body solve my issue.

mesumitsaxena

Possible Bug When Binding Data to ContentPresenter ToolTip Attribute

$
0
0

Hello everyone,

I'm developing a small application using WPF. I have a custom ListBox control which contains a number of CheckBox entries paired up with a ContentPresenter object which displays some text obtained from a custom generic object.

If I bind the ContentPresenter 'Content' node to one of the properties of my class, it will display the text I want correctly. However, I cannot do the same with its 'ToolTip' attribute.

Here's an excerpt of my XAML.

<Window.Resources><local:SandboxProfiles x:Key="profiles"/><DataTemplate x:Key="ListBoxItemTemplate"><!-- The ToolTip attribute doesn't accept dynamic data bindings (maybe a bug?) within the ContentPresenter node.
            Therefore, the attribute has to be inserted in the parent node (WrapPanel) for it to work. --><WrapPanel ToolTip="{Binding Element.FriendlyDescription}"><CheckBox IsChecked="{Binding IsSelected}" VerticalAlignment="Center" /><ContentPresenter Content="{Binding Element.TypeString, Mode=OneTime}" Margin="2,0" /></WrapPanel></DataTemplate></Window.Resources>

This line works absolutely fine like this,

<ContentPresenter Content="{Binding Element.TypeString, Mode=OneTime}" Margin="2,0" />

However, this doesn't work

<ContentPresenter Content="{Binding Element.TypeString, Mode=OneTime}" ToolTip={Binding Element.TypeString} Margin="2,0" />

Note I'm using the exact same pattern here, only that I'm applying it to the ToolTip attribute instead of Content. This doesn't work. It compiles, no exceptions, but no tooltip is displayed.

However, if I bind the ToolTip attribute of the CheckBox node or the parent WrapPanel node in the exact same way, itdoes work. This works,

<WrapPanel ToolTip="{Binding Element.TypeString}">

And this works too,

<CheckBox IsChecked="{Binding IsSelected}" ToolTip="{Binding Element.TypeString}" VerticalAlignment="Center" />

I've searched the documentation and nowhere does it say I should expect ContentPresenter's 'ToolTip' attribute to behave differently than with any other XAML component.

This has led me to believe this is a bug in the WPF runtime. If, on the other hand, I'm missing something here, please, do let me know.

Thank you.


How to use translatetransform and rotatetransform on Canvas

$
0
0

Hi,

Used TransalateTransform and Rotatetransform on canvas individually using ManipulationMode.

How to apply, both TransalateTransform and Rotatetransform on canvas Concurrently in Windows Store App.

Regards,

Chakradhar


Allignment issue in RichText box for mixture of Japanese (Kanji, Kana and half width kana) and English Char

$
0
0

Hi,

I have a Rich text box which displays initial value like below - where colon is aligned properly.

Test1                       : Value1

Test2               :  Value2
Test3               :  Value3
TestMaximumWidth :  Value4
Test4               :  Value5

The colon is aligned by adding spaces to the other items based on the maximum item's width

The user can add another add or modify the above rich text box. This will finally exported to a PDF or printed.

Now, I need to add Japanese characters to the the above richtext box. After adding the Japanese characters, the alignment is not displaying properly, shown below,

名前                   :  Value1
名前名前         :  Value2
名前/Na            :  Value3
TestMaximumWidth :  Value4
Test4 :  Value5

The colon could not be aligned. Whatever I do (even added spaces or changing fonts), there is a bit of difference. 

Please let me know a solution. The above Rich text box is currently using Winforms. Even solution in WPF is OK.




Unexpected/Unwanted WPF Element TextTrimming

$
0
0

We have a WPF application which is using PRISM.
We have a set of users which are experiencing unexpected TextTrimming after using the application for a couple of hours.
If they restart the application the issue will be resolved for a few hours.

There doesn't seem to be a pattern between the elements, other than it happens to the same users and it's the same elements. The elements which are being trimmed include button and textblocks with TextTrimming set to CharacterEllipsis and WordEllipsis.

I know these details are a little vague, but has anyone ever heard of something like this? I came across one post which suggested setting the UseLayoutRounding property on the container, which we tried with no success.

Below is an example. To the user the "New Task" button will end up getting trimmed and look like "New Ta..." while "New Appointment" is untrimmed.

<Grid><Grid.RowDefinitions><RowDefinition Height="30"/><RowDefinition Height="30"/></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions><Image Source="{StaticResource FollowUpAppointmentIcon}" Width="13" Height="14"   RenderOptions.BitmapScalingMode="NearestNeighbor" Margin="5,0"/><Image Grid.Row="1" Source="{StaticResource FollowUpTaskIcon}" Width="13" Height="14"  RenderOptions.BitmapScalingMode="NearestNeighbor" Margin="5,0"/><Button  Grid.Column="1" HorizontalAlignment="Left" ToolTip="New Appointment" Content="New Appointment" Style="{StaticResource HyperLink1}" Command="{Binding NewAppointmentCommand}" Focusable="False" Margin="5,0,15,0"/><Button Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" ToolTip="New Task" Content="New Task" Style="{StaticResource HyperLink1}" Command="{Binding NewTaskCommand}" Focusable="False" Margin="5,0,0,0"/></Grid>

And here is the style that is applied to both buttons:

<Style x:Key="HyperLink1" TargetType="{x:Type Button}"><Setter Property="FontFamily" Value="Arial"/><Setter Property="FontWeight" Value="Normal"/><Setter Property="FontSize" Value="13"/><Setter Property="VerticalAlignment" Value="Center" /><Setter Property="Cursor" Value="Hand" /><Setter Property="Foreground" Value="{DynamicResource TextHot1}" /><Setter Property="Background" Value="Transparent" /><Setter Property="FocusVisualStyle" Value="{x:Null}" /><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type Button}"><TextBlock TextDecorations="None" Text="{TemplateBinding Content}" TextTrimming="CharacterEllipsis"
                           Background="{TemplateBinding Background}" /><ControlTemplate.Triggers><Trigger Property="IsPressed" Value="True"><Setter Property="Foreground" Value="Red" /></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style>

Datepicker: hide "Select date" placeholder or change it

$
0
0
Hi,
I would hide or change the placeholder "Select a date" shown in a DatePicker.

It's possibile?


Thanks.

How can i get WPF to save upon exit

$
0
0
i am working on a college project right now and we are asked to basically create windows explorer in a WPF program. So one of the speciifications of the project is that when we terminate the program, that the program saves the current folder being viewed and opens it the next time the program is run. So i am wondering how i can get the program to save a string to a text file upon clicking the 'X' button in the top right hand corner. Btw i know to use 'System.IO.File.WriteAllLines("save.txt", StrArray);' to save to a text file i am just wondering how to get my program to perform that line when i click the X button in the upper right hand corner? Thanks in advance

Bind enum to combobox

$
0
0

Hi,

I have this enum type:

        public enum SchedActiveEnum
        {
            [Description("All")]
            All,
            [Description("Y")]
            Y,
            [Description("N")]
            N
        }

What is the better way for bind it in a combobox?

I would like to display the description but get the value.

Thanks.

How do I place the cursor and highlight a word programmatically?

$
0
0

How do I place the cursor and highlight a word programmatically?

For example, in a TextBox "this is the fox and the cat".  I want to highlight the word "fox".

int iIdx = stInfo.IndexOf("fox") finds the location, and int iLength = 3 has the length.  Now?


bhs67

Set height datagrid as height of his stackpanel, for show vertical scrollbar

$
0
0

Hi,

I have this GRID:

<Grid Margin="0,0,0,0"><Grid.RowDefinitions><RowDefinition Height="90" /><RowDefinition Height="*" /></Grid.RowDefinitions>

In 2° row I have:

<StackPanel Margin="0,0,0,50" Grid.Row="1" Visibility="Hidden" Name="stackPanelSearchResult"><GroupBox><GroupBox.Header><Label Style="{StaticResource LabelFieldset}" Content="{StaticResource menuLabelGroupBoxGrid}" /></GroupBox.Header><DataGrid Name="dgPlan"......
                ......</DataGrid></GroupBox></StackPanel></Grid>

How can I set the height of datagrid as hegith of stackpanel for show verticarl scrollbar?

Thanks.

How to create visual studio like UI designer where UI can be created at runtime using own custom controls in wpf/c#

$
0
0

Hi,

I have been working on a project where we are creating UI at runtime with our own controls. We want to have visual studio type ui designer where client can drag and drop the controls and position them. We prefer to do this in wpf as we want the xaml code of the generated ui. Xaml is xml code so we can move the generated xaml through out our application and bind that generated xaml in different modules through resource dictionary at runtime. Please suggest any pointers? Is this possible to do?

Thanks

Praveen

 


Detecting if WPF application is visible on screen

$
0
0

Hi gents, I have made an WPF application that reads data from an external device using the serial port and then visualizes it. Now, I would like to avoid reading data from the serial port when the application is not visible on the screen, thus there is no need to read data which is time consuming. So can someone please advice on how to check if the application (mainWindow) is visible or not. I have tried to make use of events such as isActive, isVisible etc. but none of the ones I tried work. I will be happy with a solution where the application is recognized as visible if just a pixel of it is visible on the screen.

Best Regards

Tom







WPF DatePicker Today Property?

$
0
0

Hi,

I have an app that a particular user leaves open for days on end.  When they day changes (either at midnight, or you can simulate by changing date on your machine) when you open the datepicker the Today date is always what it was when the control was initialized.

If I move away from the page and back again (creates new instance) then all is fine, but is there a way to reinitialize the datepicker control so that wherever it stores "Today" is updated?

cheers

andy

How do I delete the contents of a RichTextBox and add new contents? The following code concatenates to the existing contents.

$
0
0
How do I delete the contents of a RichTextBox and add new contents? The following code concatenates to the existing contents.

  gRTbx.Document.Blocks.Clear();

  gobjParagaph.Inlines.Add(new Run(st));
  gobjFlowDoc.Blocks.Add(gobjParagaph);
  gRTbx.Document = gobjFlowDoc;


bhs67

How do I gracefully handle XamlParseExceptions?

$
0
0

If a control that is dynamically loaded as part of a template has an error, it causes a XamlParseException which crashes the entire application.

I can hook into the Application.DispatcherUnhandledException event, but setting Handled to true on the DispatcherUnhandledExceptionEventArgs argument does not disable the problematic control. As a result, WPF tries again to apply the template, causing the error to be thrown once more, resulting in an infinite loop.

Is there any way to disable the problematic control so that it stops trying to render?

Here is how to reproduce this scenario:

1. Create a WPF application.

2. Add a Window called "Dialog1" and a UserControl called "UserControl1".

3. Add the following code to each file (namespaces and root XAML elements left out):

App.xaml.cs:

(Also add the following namespace reference to the top: using System.Windows.Threading;)

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        DispatcherUnhandledException += OnDispatcherUnhandledException;
    }

    private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
    {
        e.Handled = true;
    }
}

Dialog1.xaml:

(Also add the following namespace reference: xmlns:local="clr-namespace:your app namespace")

<StackPanel><Button Content="Cause XamlParseException" Click="Button_Click" /><ListBox ItemsSource="{Binding Mode=OneWay}"><ListBox.ItemTemplate><DataTemplate><local:UserControl1 /></DataTemplate></ListBox.ItemTemplate></ListBox></StackPanel>

Dialog1.xaml.cs:

public partial class Dialog1 : Window
{
    public Dialog1()
    {
        InitializeComponent();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        var list = new object[1];
        list[0] = new object();

        DataContext = list;
    }
}

MainWindow.xaml:

<StackPanel><Button Content="Show Dialog" Click="Button_Click" /></StackPanel>

MainWindow.xaml.cs:

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        var dlg = new Dialog1();
        dlg.ShowDialog();
    }
}

UserControl1.xaml.cs:

public partial class UserControl1 : UserControl
{
    public UserControl1()
    {
        InitializeComponent();

        throw new Exception();
    }
}

Run the solution, click the "Show Dialog" button, and then click the "Cause XamlParseException" button. This will cause the exception to be thrown repeatedly.

SwapChainPanel for desktop applications

$
0
0

What is the appropriate way to integrate Direct2D/Direct3D in a desktop WPF application anno Windows 8.1? Are their options to leverage DirectComposition similar to WinRT's SwapChainPanel class? Anything planned in the near future?

Thanks,

Tom


luck favours the prepared

Viewing all 18858 articles
Browse latest View live


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